summaryrefslogtreecommitdiff
path: root/docs/authentication.txt
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-09-15 21:42:51 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-09-15 21:42:51 +0000
commit5ce2e6c2c827cf877f73bf0e42e6afb7e6a71ccf (patch)
tree8c8c2fb8329e2db7dbfcf2c47026a11ff079e5c5 /docs/authentication.txt
parentea9cd5421382c047e2cc140bd6736b54ba660793 (diff)
queryset-refactor: Merged to [6220]
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6337 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/authentication.txt')
-rw-r--r--docs/authentication.txt20
1 files changed, 19 insertions, 1 deletions
diff --git a/docs/authentication.txt b/docs/authentication.txt
index 131a8930b5..820aff2712 100644
--- a/docs/authentication.txt
+++ b/docs/authentication.txt
@@ -402,11 +402,29 @@ introduced in Python 2.4::
def my_view(request):
# ...
+In the Django development version, ``login_required`` also takes an optional
+``redirect_field_name`` parameter. Example::
+
+ from django.contrib.auth.decorators import login_required
+
+ def my_view(request):
+ # ...
+ my_view = login_required(redirect_field_name='redirect_to')(my_view)
+
+Again, an equivalent example of the more compact decorator syntax introduced in Python 2.4::
+
+ from django.contrib.auth.decorators import login_required
+
+ @login_required(redirect_field_name='redirect_to')
+ def my_view(request):
+ # ...
+
``login_required`` does the following:
* If the user isn't logged in, redirect to ``settings.LOGIN_URL``
(``/accounts/login/`` by default), passing the current absolute URL
- in the query string as ``next``. For example:
+ in the query string as ``next`` or the value of ``redirect_field_name``.
+ For example:
``/accounts/login/?next=/polls/3/``.
* If the user is logged in, execute the view normally. The view code is
free to assume the user is logged in.