From 54888408a1e5552d9a42584550bda2355ed45943 Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Wed, 7 Aug 2024 23:10:49 +0200 Subject: [PATCH] Fixed #35639 -- Improved admin's delete confirmation page title. --- django/contrib/admin/actions.py | 2 +- django/contrib/admin/options.py | 2 +- tests/admin_views/test_actions.py | 1 + tests/admin_views/tests.py | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/django/contrib/admin/actions.py b/django/contrib/admin/actions.py index eefb63837e..865c16aff2 100644 --- a/django/contrib/admin/actions.py +++ b/django/contrib/admin/actions.py @@ -61,7 +61,7 @@ def delete_selected(modeladmin, request, queryset): if perms_needed or protected: title = _("Cannot delete %(name)s") % {"name": objects_name} else: - title = _("Are you sure?") + title = _("Delete multiple objects") context = { **modeladmin.admin_site.each_context(request), diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index 2257b3072e..6d5c0708a3 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -2229,7 +2229,7 @@ class ModelAdmin(BaseModelAdmin): if perms_needed or protected: title = _("Cannot delete %(name)s") % {"name": object_name} else: - title = _("Are you sure?") + title = _("Delete") context = { **self.admin_site.each_context(request), diff --git a/tests/admin_views/test_actions.py b/tests/admin_views/test_actions.py index 8e1fc144e4..467fe046ef 100644 --- a/tests/admin_views/test_actions.py +++ b/tests/admin_views/test_actions.py @@ -72,6 +72,7 @@ class AdminActionsTest(TestCase): self.assertContains( confirmation, "Are you sure you want to delete the selected subscribers?" ) + self.assertContains(confirmation, "

Delete multiple objects

") self.assertContains(confirmation, "

Summary

") self.assertContains(confirmation, "
  • Subscribers: 2
  • ") self.assertContains(confirmation, "
  • External subscribers: 1
  • ") diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index e0a4926b91..9dbe1e1432 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -3003,6 +3003,7 @@ class AdminViewPermissionsTest(TestCase): response = self.client.get( reverse("admin:admin_views_section_delete", args=(self.s1.pk,)) ) + self.assertContains(response, "

    Delete

    ") self.assertContains(response, "

    Summary

    ") self.assertContains(response, "
  • Articles: 3
  • ") # test response contains link to related Article