diff options
| author | Jannis Leidel <jannis@leidel.info> | 2012-02-09 18:56:23 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2012-02-09 18:56:23 +0000 |
| commit | 03eeb020a00dedba2594326bd606d8b41d51e80f (patch) | |
| tree | b9ced29168e8571c62b7aa35c27770c9f0491ffd /django | |
| parent | bd5861251490758e189d6d657de4683897024c70 (diff) | |
Fixed #159 -- Prevent the `AdminSite` from logging users out when they try to log in form the logout page. Many thanks, ashchristopher.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17465 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rwxr-xr-x[-rw-r--r--] | django/contrib/admin/sites.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py index 83a08699c2..4bb6440877 100644..100755 --- a/django/contrib/admin/sites.py +++ b/django/contrib/admin/sites.py @@ -1,5 +1,5 @@ from functools import update_wrapper -from django import http +from django.http import Http404, HttpResponseRedirect from django.contrib.admin import ModelAdmin, actions from django.contrib.admin.forms import AdminAuthenticationForm from django.contrib.auth import REDIRECT_FIELD_NAME @@ -188,6 +188,10 @@ class AdminSite(object): """ def inner(request, *args, **kwargs): if not self.has_permission(request): + if request.path == reverse('admin:logout', + current_app=self.name): + index_path = reverse('admin:index', current_app=self.name) + return HttpResponseRedirect(index_path) return self.login(request) return view(request, *args, **kwargs) if not cacheable: @@ -421,7 +425,7 @@ class AdminSite(object): 'models': [model_dict], } if not app_dict: - raise http.Http404('The requested admin page does not exist.') + raise Http404('The requested admin page does not exist.') # Sort the models alphabetically within each app. app_dict['models'].sort(key=lambda x: x['name']) context = { |
