From c421a4fd92990fa830f2f645df044b0f0f1fc32a Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Mon, 5 Apr 2010 12:02:27 +0000 Subject: Fixed #11949 -- Added a hook to allow ModelAdmin customization of the delete selected template. Thanks to bendavis78 for the report and patch, and Ramiro Morales for his cleanup work. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12916 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/admin_views/models.py | 1 + tests/regressiontests/admin_views/tests.py | 6 ++++++ tests/templates/custom_admin/delete_selected_confirmation.html | 1 + 3 files changed, 8 insertions(+) create mode 100644 tests/templates/custom_admin/delete_selected_confirmation.html (limited to 'tests') diff --git a/tests/regressiontests/admin_views/models.py b/tests/regressiontests/admin_views/models.py index e66e65fa85..be5782886f 100644 --- a/tests/regressiontests/admin_views/models.py +++ b/tests/regressiontests/admin_views/models.py @@ -119,6 +119,7 @@ class CustomArticleAdmin(admin.ModelAdmin): add_form_template = 'custom_admin/add_form.html' object_history_template = 'custom_admin/object_history.html' delete_confirmation_template = 'custom_admin/delete_confirmation.html' + delete_selected_confirmation_template = 'custom_admin/delete_selected_confirmation.html' def changelist_view(self, request): "Test that extra_context works" diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py index 3414ea0646..00c5db4dfb 100644 --- a/tests/regressiontests/admin_views/tests.py +++ b/tests/regressiontests/admin_views/tests.py @@ -606,6 +606,12 @@ class AdminViewPermissionsTest(TestCase): self.assertTemplateUsed(request, 'custom_admin/change_form.html') request = self.client.get('/test_admin/admin/admin_views/customarticle/1/delete/') self.assertTemplateUsed(request, 'custom_admin/delete_confirmation.html') + request = self.client.post('/test_admin/admin/admin_views/customarticle/', data={ + 'index': 0, + 'action': ['delete_selected'], + '_selected_action': ['1'], + }) + self.assertTemplateUsed(request, 'custom_admin/delete_selected_confirmation.html') request = self.client.get('/test_admin/admin/admin_views/customarticle/1/history/') self.assertTemplateUsed(request, 'custom_admin/object_history.html') diff --git a/tests/templates/custom_admin/delete_selected_confirmation.html b/tests/templates/custom_admin/delete_selected_confirmation.html new file mode 100644 index 0000000000..9268536092 --- /dev/null +++ b/tests/templates/custom_admin/delete_selected_confirmation.html @@ -0,0 +1 @@ +{% extends "admin/delete_selected_confirmation.html" %} -- cgit v1.3