From 308cf30a5ab7759c6c86204947e3c5c7821d779d Mon Sep 17 00:00:00 2001 From: Bartuccio Antoine Date: Sun, 6 Oct 2019 02:24:03 +0200 Subject: [PATCH] django2.2: replace deprecated login view --- core/urls.py | 2 +- core/views/user.py | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/core/urls.py b/core/urls.py index d937e4de..2f200266 100644 --- a/core/urls.py +++ b/core/urls.py @@ -37,7 +37,7 @@ urlpatterns = [ re_path(r"^search_json/$", search_json, name="search_json"), re_path(r"^search_user/$", search_user_json, name="search_user"), # Login and co - re_path(r"^login/$", login, name="login"), + re_path(r"^login/$", SithLoginView.as_view(), name="login"), re_path(r"^logout/$", logout, name="logout"), re_path(r"^password_change/$", password_change, name="password_change"), re_path( diff --git a/core/views/user.py b/core/views/user.py index 1b4ebdf4..1dd0f17e 100644 --- a/core/views/user.py +++ b/core/views/user.py @@ -69,15 +69,13 @@ from counter.views import StudentCardForm from trombi.views import UserTrombiForm -def login(request): +class SithLoginView(views.LoginView): + """ + The login View """ - The login view - Needs to be improve with correct handling of form exceptions - """ - return views.login( - request, template_name="core/login.jinja", authentication_form=LoginForm - ) + template_name = "core/login.jinja" + authentication_form = LoginForm def logout(request):