summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorVíðir Valberg Guðmundsson <valberg@orn.li>2014-05-17 12:05:29 +0200
committerTim Graham <timograham@gmail.com>2014-05-17 09:46:29 -0400
commitf3b082901774463319fbb6e918b0d846289620bf (patch)
tree551934f345216d43eb144232876cbc7a21ff9134 /docs
parent91e03e81bbfee069dc7a4b6e23d4ac30731c65d0 (diff)
[1.6.x] Fixed #22647 -- Documented redirect_field_name keyword argument for user_passes_test.
Backport of 268670a3a4 from master
Diffstat (limited to 'docs')
-rw-r--r--docs/topics/auth/default.txt18
1 files changed, 14 insertions, 4 deletions
diff --git a/docs/topics/auth/default.txt b/docs/topics/auth/default.txt
index 503a26565c..79772aa2a8 100644
--- a/docs/topics/auth/default.txt
+++ b/docs/topics/auth/default.txt
@@ -504,7 +504,7 @@ checks to make sure the user has an email in the desired domain::
return HttpResponse("You can't vote in this poll.")
# ...
-.. function:: user_passes_test(func, [login_url=None])
+.. function:: user_passes_test(func, [login_url=None, redirect_field_name=REDIRECT_FIELD_NAME])
As a shortcut, you can use the convenient ``user_passes_test`` decorator::
@@ -525,9 +525,19 @@ checks to make sure the user has an email in the desired domain::
automatically check that the :class:`~django.contrib.auth.models.User` is
not anonymous.
- :func:`~django.contrib.auth.decorators.user_passes_test()` takes an
- optional ``login_url`` argument, which lets you specify the URL for your
- login page (:setting:`settings.LOGIN_URL <LOGIN_URL>` by default).
+ :func:`~django.contrib.auth.decorators.user_passes_test` takes two
+ optional arguments:
+
+ ``login_url``
+ Lets you specify the URL that users who don't pass the test will be
+ redirected to. It may be a login page and defaults to
+ :setting:`settings.LOGIN_URL <LOGIN_URL>` if you don't specify one.
+
+ ``redirect_field_name``
+ Same as for :func:`~django.contrib.auth.decorators.login_required`.
+ Setting it to ``None`` removes it from the URL, which you may want to do
+ if you are redirecting users that don't pass the test to a non-login
+ page where there's no "next page".
For example::