summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/contrib/admin/actions.py2
-rw-r--r--django/contrib/admin/options.py1
-rw-r--r--docs/ref/contrib/admin/index.txt9
-rw-r--r--tests/regressiontests/admin_views/models.py1
-rw-r--r--tests/regressiontests/admin_views/tests.py6
5 files changed, 18 insertions, 1 deletions
diff --git a/django/contrib/admin/actions.py b/django/contrib/admin/actions.py
index 8d03c6ce5a..b75c91b75a 100644
--- a/django/contrib/admin/actions.py
+++ b/django/contrib/admin/actions.py
@@ -64,7 +64,7 @@ def delete_selected(modeladmin, request, queryset):
}
# Display the confirmation page
- return render_to_response(modeladmin.delete_confirmation_template or [
+ return render_to_response(modeladmin.delete_selected_confirmation_template or [
"admin/%s/%s/delete_selected_confirmation.html" % (app_label, opts.object_name.lower()),
"admin/%s/delete_selected_confirmation.html" % app_label,
"admin/delete_selected_confirmation.html"
diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
index 4fb1679ebe..44d5d0b7f1 100644
--- a/django/contrib/admin/options.py
+++ b/django/contrib/admin/options.py
@@ -189,6 +189,7 @@ class ModelAdmin(BaseModelAdmin):
change_form_template = None
change_list_template = None
delete_confirmation_template = None
+ delete_selected_confirmation_template = None
object_history_template = None
# Actions
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
index 2967b11425..f7ad31c15e 100644
--- a/docs/ref/contrib/admin/index.txt
+++ b/docs/ref/contrib/admin/index.txt
@@ -698,6 +698,15 @@ templates used by the :class:`ModelAdmin` views:
Path to a custom template, used by :meth:`delete_view` for displaying a
confirmation page when deleting one or more objects.
+.. attribute:: ModelAdmin.delete_selected_confirmation_template
+
+ .. versionadded:: 1.1.2
+
+ Path to a custom template, used by the :meth:`delete_selected`
+ action method for displaying a confirmation page when deleting one
+ or more objects. See the :ref:`actions
+ documentation<ref-contrib-admin-actions>`.
+
.. attribute:: ModelAdmin.object_history_template
Path to a custom template, used by :meth:`history_view`.
diff --git a/tests/regressiontests/admin_views/models.py b/tests/regressiontests/admin_views/models.py
index 0caa8946c1..cf714631bc 100644
--- a/tests/regressiontests/admin_views/models.py
+++ b/tests/regressiontests/admin_views/models.py
@@ -115,6 +115,7 @@ class CustomArticleAdmin(admin.ModelAdmin):
change_form_template = 'custom_admin/change_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 129f93cdac..c297e37a43 100644
--- a/tests/regressiontests/admin_views/tests.py
+++ b/tests/regressiontests/admin_views/tests.py
@@ -579,6 +579,12 @@ class AdminViewPermissionsTest(TestCase):
# Test custom delete and object history templates
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')