summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2006-05-22 02:46:55 +0000
committerAdrian Holovaty <adrian@holovaty.com>2006-05-22 02:46:55 +0000
commitbe57a7fd1a743672fb4bd682950674aa6823190d (patch)
tree5151c277cd34dbd51ad842e8b39059989d89c11b /django
parent75df13278caaceedd444c43c970c7d000f19b855 (diff)
Fixed #849 -- Improved login_required view decorator to save query-string parameters. Also added documentation on the django.contrib.auth.views.login view to docs/authentication.txt
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2954 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/contrib/auth/decorators.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/django/contrib/auth/decorators.py b/django/contrib/auth/decorators.py
index 4b264cf815..bc8ec39115 100644
--- a/django/contrib/auth/decorators.py
+++ b/django/contrib/auth/decorators.py
@@ -1,5 +1,6 @@
from django.contrib.auth import LOGIN_URL, REDIRECT_FIELD_NAME
from django.http import HttpResponseRedirect
+from urllib import quote
def user_passes_test(test_func, login_url=LOGIN_URL):
"""
@@ -11,7 +12,7 @@ def user_passes_test(test_func, login_url=LOGIN_URL):
def _checklogin(request, *args, **kwargs):
if test_func(request.user):
return view_func(request, *args, **kwargs)
- return HttpResponseRedirect('%s?%s=%s' % (login_url, REDIRECT_FIELD_NAME, request.path))
+ return HttpResponseRedirect('%s?%s=%s' % (login_url, REDIRECT_FIELD_NAME, quote(request.get_full_path())))
return _checklogin
return _dec