diff options
| author | ZachLiuGIS <zachliugis@gmail.com> | 2017-09-01 09:07:03 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-09-03 12:06:44 -0400 |
| commit | 2dacc2ccd9593678f19b61ecfe1bc6ee826c2a88 (patch) | |
| tree | 3eda5433a64950d5dda01de46cc6b7844c5c8dd7 /django | |
| parent | fe0184b4121dd68b827575fc2116a65703c5be08 (diff) | |
Fixed #28550 -- Restored contrib.auth's login() and logout() views' respect of positional arguments.
Regression in 78963495d0caadb77eb97ccf319ef0ba3b204fb5.
Forwardport of f8e0557b01ebbb11478cfb012c4cafc67f1213c1 from stable/1.11.x
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/auth/views.py | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/django/contrib/auth/views.py b/django/contrib/auth/views.py index 7791d9a7fd..3339e30eb2 100644 --- a/django/contrib/auth/views.py +++ b/django/contrib/auth/views.py @@ -107,12 +107,21 @@ class LoginView(SuccessURLAllowedHostsMixin, FormView): return context -def login(request, *args, **kwargs): +def login(request, template_name='registration/login.html', + redirect_field_name=REDIRECT_FIELD_NAME, + authentication_form=AuthenticationForm, + extra_context=None, redirect_authenticated_user=False): warnings.warn( 'The login() view is superseded by the class-based LoginView().', RemovedInDjango21Warning, stacklevel=2 ) - return LoginView.as_view(**kwargs)(request, *args, **kwargs) + return LoginView.as_view( + template_name=template_name, + redirect_field_name=redirect_field_name, + form_class=authentication_form, + extra_context=extra_context, + redirect_authenticated_user=redirect_authenticated_user, + )(request) class LogoutView(SuccessURLAllowedHostsMixin, TemplateView): @@ -175,12 +184,20 @@ class LogoutView(SuccessURLAllowedHostsMixin, TemplateView): return context -def logout(request, *args, **kwargs): +def logout(request, next_page=None, + template_name='registration/logged_out.html', + redirect_field_name=REDIRECT_FIELD_NAME, + extra_context=None): warnings.warn( 'The logout() view is superseded by the class-based LogoutView().', RemovedInDjango21Warning, stacklevel=2 ) - return LogoutView.as_view(**kwargs)(request, *args, **kwargs) + return LogoutView.as_view( + next_page=next_page, + template_name=template_name, + redirect_field_name=redirect_field_name, + extra_context=extra_context, + )(request) _sentinel = object() |
