0
0
mirror of https://github.com/django/django.git synced 2024-12-01 15:42:04 +01:00

Fixed #23898 -- Added missing context to admin's deleted_selected view.

Thanks Redouane Zait for the report.
This commit is contained in:
Redouane Zait 2014-11-23 15:08:34 +01:00 committed by Tim Graham
parent 392e11945f
commit 8e7b384d89
3 changed files with 16 additions and 11 deletions

View File

@ -63,17 +63,18 @@ def delete_selected(modeladmin, request, queryset):
else: else:
title = _("Are you sure?") title = _("Are you sure?")
context = { context = dict(
"title": title, modeladmin.admin_site.each_context(),
"objects_name": objects_name, title=title,
"deletable_objects": [deletable_objects], objects_name=objects_name,
"model_count": dict(model_count), deletable_objects=[deletable_objects],
'queryset': queryset, model_count=dict(model_count),
"perms_lacking": perms_needed, queryset=queryset,
"protected": protected, perms_lacking=perms_needed,
"opts": opts, protected=protected,
'action_checkbox_name': helpers.ACTION_CHECKBOX_NAME, opts=opts,
} action_checkbox_name=helpers.ACTION_CHECKBOX_NAME,
)
# Display the confirmation page # Display the confirmation page
return TemplateResponse(request, modeladmin.delete_selected_confirmation_template or [ return TemplateResponse(request, modeladmin.delete_selected_confirmation_template or [

View File

@ -80,3 +80,6 @@ Bugfixes
* Fixed ``django.core.files.File.__repr__()`` when the file's ``name`` contains * Fixed ``django.core.files.File.__repr__()`` when the file's ``name`` contains
Unicode characters (:ticket:`23888`). Unicode characters (:ticket:`23888`).
* Added missing context to the admin's ``delete_selected`` view that prevented
custom site header, etc. from appearing (:ticket:`23898`).

View File

@ -838,6 +838,7 @@ class AdminCustomTemplateTests(AdminViewBasicTestCase):
'_selected_action': group.id '_selected_action': group.id
} }
response = self.client.post('/test_admin/%s/auth/group/' % (self.urlbit), post_data) response = self.client.post('/test_admin/%s/auth/group/' % (self.urlbit), post_data)
self.assertEqual(response.context['site_header'], 'Django administration')
self.assertContains(response, 'bodyclass_consistency_check ') self.assertContains(response, 'bodyclass_consistency_check ')
def test_filter_with_custom_template(self): def test_filter_with_custom_template(self):