mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Fixed #28550 -- Restored contrib.auth's login() and logout() views' respect of positional arguments.
Regression in78963495d0. Forwardport off8e0557b01from stable/1.11.x
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user