mirror of
				https://github.com/django/django.git
				synced 2025-11-04 05:35:37 +00:00 
			
		
		
		
	Fixed #26558 -- Removed need for request context processor on admin login page.
This commit is contained in:
		
							parent
							
								
									ad0f536e1c
								
							
						
					
					
						commit
						1206eea11e
					
				
					 5 changed files with 19 additions and 3 deletions
				
			
		
							
								
								
									
										1
									
								
								AUTHORS
									
										
									
									
									
								
							
							
						
						
									
										1
									
								
								AUTHORS
									
										
									
									
									
								
							| 
						 | 
					@ -183,6 +183,7 @@ answer newbie questions, and generally made Django that much better:
 | 
				
			||||||
    Danilo Bargen
 | 
					    Danilo Bargen
 | 
				
			||||||
    Dan Johnson <danj.py@gmail.com>
 | 
					    Dan Johnson <danj.py@gmail.com>
 | 
				
			||||||
    Dan Poirier <poirier@pobox.com>
 | 
					    Dan Poirier <poirier@pobox.com>
 | 
				
			||||||
 | 
					    Dan Stephenson <http://dan.io/>
 | 
				
			||||||
    Dan Watson <http://danwatson.net/>
 | 
					    Dan Watson <http://danwatson.net/>
 | 
				
			||||||
    dave@thebarproject.com
 | 
					    dave@thebarproject.com
 | 
				
			||||||
    David Ascher <http://ascher.ca/>
 | 
					    David Ascher <http://ascher.ca/>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -361,6 +361,7 @@ class AdminSite(object):
 | 
				
			||||||
            self.each_context(request),
 | 
					            self.each_context(request),
 | 
				
			||||||
            title=_('Log in'),
 | 
					            title=_('Log in'),
 | 
				
			||||||
            app_path=request.get_full_path(),
 | 
					            app_path=request.get_full_path(),
 | 
				
			||||||
 | 
					            username=request.user.get_username(),
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        if (REDIRECT_FIELD_NAME not in request.GET and
 | 
					        if (REDIRECT_FIELD_NAME not in request.GET and
 | 
				
			||||||
                REDIRECT_FIELD_NAME not in request.POST):
 | 
					                REDIRECT_FIELD_NAME not in request.POST):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,7 +34,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{% if user.is_authenticated %}
 | 
					{% if user.is_authenticated %}
 | 
				
			||||||
<p class="errornote">
 | 
					<p class="errornote">
 | 
				
			||||||
{% blocktrans with username=request.user.get_username trimmed %}
 | 
					{% blocktrans trimmed %}
 | 
				
			||||||
    You are authenticated as {{ username }}, but are not authorized to
 | 
					    You are authenticated as {{ username }}, but are not authorized to
 | 
				
			||||||
    access this page. Would you like to login to a different account?
 | 
					    access this page. Would you like to login to a different account?
 | 
				
			||||||
{% endblocktrans %}
 | 
					{% endblocktrans %}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,4 +9,5 @@ Django 1.9.7 fixes several bugs in 1.9.6.
 | 
				
			||||||
Bugfixes
 | 
					Bugfixes
 | 
				
			||||||
========
 | 
					========
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* ...
 | 
					* Removed the need for the ``request`` context processor on the admin login
 | 
				
			||||||
 | 
					  page to fix a regression in 1.9 (:ticket:`26558`).
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1279,7 +1279,20 @@ def get_perm(Model, perm):
 | 
				
			||||||
    return Permission.objects.get(content_type=ct, codename=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):
 | 
					class AdminViewPermissionsTest(TestCase):
 | 
				
			||||||
    """Tests for Admin Views Permissions."""
 | 
					    """Tests for Admin Views Permissions."""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue