mirror of https://github.com/django/django.git
Refs #32681 -- Fixed VariableDoesNotExist when rendering some admin template.
Regression in84609b3205
. Follow up to4e5bbb6ef2
. Thanks Sourav Kumar for the report.
This commit is contained in:
parent
6815da6e94
commit
0a4a5e5bac
|
@ -59,6 +59,7 @@ def delete_selected(modeladmin, request, queryset):
|
|||
context = {
|
||||
**modeladmin.admin_site.each_context(request),
|
||||
'title': title,
|
||||
'subtitle': None,
|
||||
'objects_name': str(objects_name),
|
||||
'deletable_objects': [deletable_objects],
|
||||
'model_count': dict(model_count).items(),
|
||||
|
|
|
@ -400,6 +400,7 @@ class AdminSite:
|
|||
context = {
|
||||
**self.each_context(request),
|
||||
'title': _('Log in'),
|
||||
'subtitle': None,
|
||||
'app_path': request.get_full_path(),
|
||||
'username': request.user.get_username(),
|
||||
}
|
||||
|
|
|
@ -162,6 +162,7 @@ class LogoutView(SuccessURLAllowedHostsMixin, TemplateView):
|
|||
'site': current_site,
|
||||
'site_name': current_site.name,
|
||||
'title': _('Logged out'),
|
||||
'subtitle': None,
|
||||
**(self.extra_context or {})
|
||||
})
|
||||
return context
|
||||
|
@ -204,6 +205,7 @@ class PasswordContextMixin:
|
|||
context = super().get_context_data(**kwargs)
|
||||
context.update({
|
||||
'title': self.title,
|
||||
'subtitle': None,
|
||||
**(self.extra_context or {})
|
||||
})
|
||||
return context
|
||||
|
|
|
@ -1122,15 +1122,29 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
|
|||
def test_render_views_no_subtitle(self):
|
||||
tests = [
|
||||
reverse('admin:index'),
|
||||
reverse('admin:password_change'),
|
||||
reverse('admin:app_list', args=('admin_views',)),
|
||||
reverse('admin:admin_views_article_delete', args=(self.a1.pk,)),
|
||||
reverse('admin:admin_views_article_history', args=(self.a1.pk,)),
|
||||
# Login must be after logout.
|
||||
reverse('admin:logout'),
|
||||
reverse('admin:login'),
|
||||
]
|
||||
for url in tests:
|
||||
with self.subTest(url=url):
|
||||
with self.assertNoLogs('django.template', 'DEBUG'):
|
||||
self.client.get(url)
|
||||
|
||||
def test_render_delete_selected_confirmation_no_subtitle(self):
|
||||
post_data = {
|
||||
'action': 'delete_selected',
|
||||
'selected_across': '0',
|
||||
'index': '0',
|
||||
'_selected_action': self.a1.pk,
|
||||
}
|
||||
with self.assertNoLogs('django.template', 'DEBUG'):
|
||||
self.client.post(reverse('admin:admin_views_article_changelist'), post_data)
|
||||
|
||||
|
||||
@override_settings(TEMPLATES=[{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
|
|
Loading…
Reference in New Issue