summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rw-r--r--django/contrib/admin/sites.py1
-rw-r--r--django/contrib/admin/templates/admin/login.html2
-rw-r--r--docs/releases/1.9.7.txt3
-rw-r--r--tests/admin_views/tests.py15
5 files changed, 19 insertions, 3 deletions
diff --git a/AUTHORS b/AUTHORS
index c7ed5afd6f..e217143ac8 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -183,6 +183,7 @@ answer newbie questions, and generally made Django that much better:
Danilo Bargen
Dan Johnson <danj.py@gmail.com>
Dan Poirier <poirier@pobox.com>
+ Dan Stephenson <http://dan.io/>
Dan Watson <http://danwatson.net/>
dave@thebarproject.com
David Ascher <http://ascher.ca/>
diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py
index dbc0472ab7..aaa56f1296 100644
--- a/django/contrib/admin/sites.py
+++ b/django/contrib/admin/sites.py
@@ -361,6 +361,7 @@ class AdminSite(object):
self.each_context(request),
title=_('Log in'),
app_path=request.get_full_path(),
+ username=request.user.get_username(),
)
if (REDIRECT_FIELD_NAME not in request.GET and
REDIRECT_FIELD_NAME not in request.POST):
diff --git a/django/contrib/admin/templates/admin/login.html b/django/contrib/admin/templates/admin/login.html
index 4c0dc63dcf..397eadf4a2 100644
--- a/django/contrib/admin/templates/admin/login.html
+++ b/django/contrib/admin/templates/admin/login.html
@@ -34,7 +34,7 @@
{% if user.is_authenticated %}
<p class="errornote">
-{% blocktrans with username=request.user.get_username trimmed %}
+{% blocktrans trimmed %}
You are authenticated as {{ username }}, but are not authorized to
access this page. Would you like to login to a different account?
{% endblocktrans %}
diff --git a/docs/releases/1.9.7.txt b/docs/releases/1.9.7.txt
index 3599c12bd7..c93339a9d2 100644
--- a/docs/releases/1.9.7.txt
+++ b/docs/releases/1.9.7.txt
@@ -9,4 +9,5 @@ Django 1.9.7 fixes several bugs in 1.9.6.
Bugfixes
========
-* ...
+* Removed the need for the ``request`` context processor on the admin login
+ page to fix a regression in 1.9 (:ticket:`26558`).
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index b1c7a29a03..281084a8a1 100644
--- a/tests/admin_views/tests.py
+++ b/tests/admin_views/tests.py
@@ -1279,7 +1279,20 @@ def get_perm(Model, perm):
return Permission.objects.get(content_type=ct, codename=perm)
-@override_settings(ROOT_URLCONF='admin_views.urls')
+@override_settings(
+ ROOT_URLCONF='admin_views.urls',
+ # Test with the admin's documented list of required context processors.
+ TEMPLATES=[{
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'APP_DIRS': True,
+ 'OPTIONS': {
+ 'context_processors': [
+ 'django.contrib.auth.context_processors.auth',
+ 'django.contrib.messages.context_processors.messages',
+ ],
+ },
+ }],
+)
class AdminViewPermissionsTest(TestCase):
"""Tests for Admin Views Permissions."""