14 | | I can not capture 'Message' with LoginView. |
15 | | |
16 | | --------------------- |
17 | | project urls: |
18 | | |
19 | | urlpatterns = [ |
20 | | path('admin/', admin.site.urls), |
21 | | path('', include('django.contrib.auth.urls')), |
22 | | path('', include('base.urls')), |
23 | | ] |
24 | | --------------------- |
25 | | |
26 | | the base apps urls: |
27 | | # app_name = 'base' |
28 | | |
29 | | urlpatterns = [ |
30 | | path('', views.Home.as_view(), name='home'), |
31 | | path('room/<int:pk>/', views.Room.as_view(), name='room'), |
32 | | path('create-room/', views.CreateRoom.as_view(), name='create-room'), |
33 | | path('update-room/<int:pk>/', views.UpdateRoom.as_view(model=Room), name='update-room'), |
34 | | path('delete-room/<int:pk>/', views.DeleteRoom.as_view(model=Room), name='delete-room'), |
35 | | path('login/', views.Login.as_view(), name='login') |
36 | | ] |
37 | | --------------------- |
38 | | |
39 | | settings.py |
40 | | |
41 | | |
42 | | INSTALLED_APPS = [ |
43 | | # Default django apps |
44 | | 'django.contrib.admin', |
45 | | 'django.contrib.auth', |
46 | | 'django.contrib.contenttypes', |
47 | | 'django.contrib.sessions', |
48 | | 'django.contrib.messages', |
49 | | 'django.contrib.staticfiles', |
50 | | |
51 | | # My custom apps |
52 | | 'base.apps.BaseConfig', |
53 | | ] |
54 | | |
55 | | MIDDLEWARE = [ |
56 | | 'django.middleware.security.SecurityMiddleware', |
57 | | 'django.contrib.sessions.middleware.SessionMiddleware', |
58 | | 'django.middleware.common.CommonMiddleware', |
59 | | 'django.middleware.csrf.CsrfViewMiddleware', |
60 | | 'django.contrib.auth.middleware.AuthenticationMiddleware', |
61 | | 'django.contrib.messages.middleware.MessageMiddleware', |
62 | | 'django.middleware.clickjacking.XFrameOptionsMiddleware', |
63 | | ] |
64 | | |
65 | | ROOT_URLCONF = 'studybud.urls' |
66 | | |
67 | | TEMPLATES = [ |
68 | | { |
69 | | 'BACKEND': 'django.template.backends.django.DjangoTemplates', |
70 | | 'DIRS': [BASE_DIR / 'templates'] |
71 | | , |
72 | | 'APP_DIRS': True, |
73 | | 'OPTIONS': { |
74 | | 'context_processors': [ |
75 | | 'django.template.context_processors.debug', |
76 | | 'django.template.context_processors.request', |
77 | | 'django.contrib.auth.context_processors.auth', |
78 | | 'django.contrib.messages.context_processors.messages', |
79 | | ], |
80 | | }, |
81 | | }, |
82 | | ] |
83 | | |
84 | | WSGI_APPLICATION = 'studybud.wsgi.application' |
85 | | |
86 | | # Database |
87 | | # https://docs.djangoproject.com/en/4.0/ref/settings/#databases |
88 | | |
89 | | DATABASES = { |
90 | | 'default': { |
91 | | 'ENGINE': 'django.db.backends.sqlite3', |
92 | | 'NAME': BASE_DIR / 'db.sqlite3', |
93 | | } |
94 | | } |
95 | | |
96 | | # Password validation |
97 | | # https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators |
98 | | |
99 | | AUTH_PASSWORD_VALIDATORS = [ |
100 | | { |
101 | | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', |
102 | | }, |
103 | | { |
104 | | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', |
105 | | }, |
106 | | { |
107 | | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', |
108 | | }, |
109 | | { |
110 | | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', |
111 | | }, |
112 | | ] |
113 | | |
114 | | # Internationalization |
115 | | # https://docs.djangoproject.com/en/4.0/topics/i18n/ |
116 | | |
117 | | LANGUAGE_CODE = 'en-us' |
118 | | |
119 | | TIME_ZONE = 'UTC' |
120 | | |
121 | | USE_I18N = True |
122 | | |
123 | | USE_TZ = True |
124 | | |
125 | | # Static files (CSS, JavaScript, Images) |
126 | | # https://docs.djangoproject.com/en/4.0/howto/static-files/ |
127 | | |
128 | | STATIC_URL = 'static/' |
129 | | |
130 | | # Default primary key field type |
131 | | # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field |
132 | | |
133 | | DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' |
134 | | |
135 | | # Login redirect |
136 | | LOGIN_REDIRECT_URL = 'home' |
137 | | LOGIN_URL = 'login' |
| 18 | I can not capture 'Message' with `LoginView`. |