summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorThinkChaos <ThinkChaos@users.noreply.github.com>2017-06-07 16:48:28 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-02-08 21:08:05 +0100
commitb99d6c9cbc8eecf480892599201eef0d14b20d71 (patch)
treea563f6643d977ba1b97f2674da5e002a700399f5 /docs
parent59841170ba1785ada10a2915b0b60efdb046ee39 (diff)
Fixed #28216 -- Added next_page/get_default_redirect_url() to LoginView.
Diffstat (limited to 'docs')
-rw-r--r--docs/releases/4.0.txt6
-rw-r--r--docs/topics/auth/default.txt21
2 files changed, 25 insertions, 2 deletions
diff --git a/docs/releases/4.0.txt b/docs/releases/4.0.txt
index 37783b906b..296967a92b 100644
--- a/docs/releases/4.0.txt
+++ b/docs/releases/4.0.txt
@@ -47,6 +47,12 @@ Minor features
* The default iteration count for the PBKDF2 password hasher is increased from
260,000 to 320,000.
+* The new
+ :attr:`LoginView.next_page <django.contrib.auth.views.LoginView.next_page>`
+ attribute and
+ :meth:`~django.contrib.auth.views.LoginView.get_default_redirect_url` method
+ allow customizing the redirect after login.
+
:mod:`django.contrib.contenttypes`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/docs/topics/auth/default.txt b/docs/topics/auth/default.txt
index 05ccc5eed6..82cf58c128 100644
--- a/docs/topics/auth/default.txt
+++ b/docs/topics/auth/default.txt
@@ -996,17 +996,26 @@ implementation details see :ref:`using-the-views`.
See :doc:`the URL documentation </topics/http/urls>` for details on using
named URL patterns.
- **Attributes:**
+ **Methods and Attributes**
.. attribute:: template_name
The name of a template to display for the view used to log the user in.
Defaults to :file:`registration/login.html`.
+ .. attribute:: next_page
+
+ .. versionadded:: 4.0
+
+ The URL to redirect to after login. Defaults to
+ :setting:`LOGIN_REDIRECT_URL`.
+
.. attribute:: redirect_field_name
The name of a ``GET`` field containing the URL to redirect to after
- login. Defaults to ``next``.
+ login. Defaults to ``next``. Overrides the
+ :meth:`get_default_redirect_url` URL if the given ``GET`` parameter is
+ passed.
.. attribute:: authentication_form
@@ -1043,6 +1052,14 @@ implementation details see :ref:`using-the-views`.
<django.http.HttpRequest.get_host>`, that are safe for redirecting
after login. Defaults to an empty :class:`set`.
+ .. method:: get_default_redirect_url()
+
+ .. versionadded:: 4.0
+
+ Returns the URL to redirect to after login. The default implementation
+ resolves and returns :attr:`next_page` if set, or
+ :setting:`LOGIN_REDIRECT_URL` otherwise.
+
Here's what ``LoginView`` does:
* If called via ``GET``, it displays a login form that POSTs to the