summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorBryan Marty <bryanmarty@gmail.com>2015-10-30 13:26:09 -0700
committerTim Graham <timograham@gmail.com>2015-11-12 14:23:59 -0500
commit9788625277b85596302bbf2c39cf829b7a766a4f (patch)
treef1a3636e60877ff594897f831ccefb90f1e3b642 /docs
parent9a2aca60304dc2e98f9ef45636e129d225cb981f (diff)
Fixed #25169 -- Documented stacking of permission_required and login_required.
Diffstat (limited to 'docs')
-rw-r--r--docs/topics/auth/default.txt11
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/topics/auth/default.txt b/docs/topics/auth/default.txt
index 5ba0b67774..ab11d61781 100644
--- a/docs/topics/auth/default.txt
+++ b/docs/topics/auth/default.txt
@@ -687,6 +687,17 @@ The ``permission_required`` decorator
(HTTP Forbidden) view<http_forbidden_view>` instead of redirecting to the
login page.
+ If you want to use ``raise_exception`` but also give your users a chance to
+ login first, you can add the
+ :func:`~django.contrib.auth.decorators.login_required` decorator::
+
+ from django.contrib.auth.decorators import login_required, permission_required
+
+ @permission_required('polls.can_vote', raise_exception=True)
+ @login_required
+ def my_view(request):
+ ...
+
.. versionchanged:: 1.9
In older versions, the ``permission`` parameter only worked with