Renamed LogoutView.get_next_page() to get_success_url().
This aligns it with LoginView. Also, it removes confusion with the get_next_page() method of paginators. get_next_page() was a private API, therefore this refactoring is allowed.
This commit is contained in:
parent
12576bd371
commit
5b8699e723
|
@ -142,16 +142,16 @@ class LogoutView(RedirectURLMixin, TemplateView):
|
||||||
def post(self, request, *args, **kwargs):
|
def post(self, request, *args, **kwargs):
|
||||||
"""Logout may be done via POST."""
|
"""Logout may be done via POST."""
|
||||||
auth_logout(request)
|
auth_logout(request)
|
||||||
next_page = self.get_next_page()
|
redirect_to = self.get_success_url()
|
||||||
if next_page:
|
if redirect_to:
|
||||||
# Redirect to this page until the session has been cleared.
|
# Redirect to this page until the session has been cleared.
|
||||||
return HttpResponseRedirect(next_page)
|
return HttpResponseRedirect(redirect_to)
|
||||||
return super().get(request, *args, **kwargs)
|
return super().get(request, *args, **kwargs)
|
||||||
|
|
||||||
# RemovedInDjango50Warning.
|
# RemovedInDjango50Warning.
|
||||||
get = post
|
get = post
|
||||||
|
|
||||||
def get_next_page(self):
|
def get_success_url(self):
|
||||||
if self.next_page is not None:
|
if self.next_page is not None:
|
||||||
next_page = resolve_url(self.next_page)
|
next_page = resolve_url(self.next_page)
|
||||||
elif settings.LOGOUT_REDIRECT_URL:
|
elif settings.LOGOUT_REDIRECT_URL:
|
||||||
|
|
Loading…
Reference in New Issue