From 792ca148a2d6da6cf0778f6a866c899208ab94f9 Mon Sep 17 00:00:00 2001 From: antoliny0919 Date: Tue, 29 Jul 2025 18:03:52 +0900 Subject: [PATCH] Fixed #36528, Refs #34917 -- Removed role="button" from object-tools links. Regression in 849f8307a5bb33465252d0891a9b2c47dde65889. In order to prevent underlines on links styled like buttons, role="button" was added. This has been removed and the style updated to reflect that these are links. --- .../contrib/admin/static/admin/css/base.css | 3 +- .../admin/change_form_object_tools.html | 2 +- .../admin/change_list_object_tools.html | 2 +- tests/admin_views/tests.py | 32 +++++++++++++++++-- 4 files changed, 34 insertions(+), 5 deletions(-) diff --git a/django/contrib/admin/static/admin/css/base.css b/django/contrib/admin/static/admin/css/base.css index 082dafc141..0668d59b29 100644 --- a/django/contrib/admin/static/admin/css/base.css +++ b/django/contrib/admin/static/admin/css/base.css @@ -129,7 +129,8 @@ a:not( [role="button"], #header a, #nav-sidebar a, - #content-main.app-list a + #content-main.app-list a, + .object-tools a, ) { text-decoration: underline; } diff --git a/django/contrib/admin/templates/admin/change_form_object_tools.html b/django/contrib/admin/templates/admin/change_form_object_tools.html index 2ab2b541e7..067ae83761 100644 --- a/django/contrib/admin/templates/admin/change_form_object_tools.html +++ b/django/contrib/admin/templates/admin/change_form_object_tools.html @@ -2,7 +2,7 @@ {% block object-tools-items %}
  • {% url opts|admin_urlname:'history' original.pk|admin_urlquote as history_url %} - {% translate "History" %} + {% translate "History" %}
  • {% if has_absolute_url %}
  • {% translate "View on site" %}
  • {% endif %} {% endblock %} diff --git a/django/contrib/admin/templates/admin/change_list_object_tools.html b/django/contrib/admin/templates/admin/change_list_object_tools.html index 35bff31fb7..11cc6fa4ba 100644 --- a/django/contrib/admin/templates/admin/change_list_object_tools.html +++ b/django/contrib/admin/templates/admin/change_list_object_tools.html @@ -4,7 +4,7 @@ {% if has_add_permission %}
  • {% url cl.opts|admin_urlname:'add' as add_url %} - + {% blocktranslate with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktranslate %}
  • diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index 65241becc0..26fdacfa00 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -4086,7 +4086,7 @@ class AdminViewStringPrimaryKeyTest(TestCase): ) self.assertContains( response, - 'History', + 'History', response.text, ) self.assertURLEqual(history_link[1], self.get_history_url())