diff --git a/django/contrib/admin/templates/admin/app_list.html b/django/contrib/admin/templates/admin/app_list.html index 941680d89b..3b67b5feab 100644 --- a/django/contrib/admin/templates/admin/app_list.html +++ b/django/contrib/admin/templates/admin/app_list.html @@ -10,7 +10,7 @@ {% for model in app.models %} {% with model_name=model.object_name|lower %} - + {% if model.admin_url %} {{ model.name }} {% else %} @@ -19,16 +19,16 @@ {% if model.add_url %} - {% translate 'Add' %} + {% translate 'Add' %} {% else %} {% endif %} {% if model.admin_url and show_changelinks %} {% if model.view_only %} - {% translate 'View' %} + {% translate 'View' %} {% else %} - {% translate 'Change' %} + {% translate 'Change' %} {% endif %} {% elif show_changelinks %} diff --git a/tests/admin_views/test_nav_sidebar.py b/tests/admin_views/test_nav_sidebar.py index e9b367b63b..1875a2f7a1 100644 --- a/tests/admin_views/test_nav_sidebar.py +++ b/tests/admin_views/test_nav_sidebar.py @@ -111,9 +111,10 @@ class AdminSidebarTests(TestCase): self.assertContains(response, '') self.assertContains( response, - '' + '' '' "Héllos", + html=True, ) diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index 98a77221b2..cb61c88941 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -1605,6 +1605,29 @@ class AdminViewBasicTest(AdminViewBasicTestCase): '
', ) + def test_aria_describedby_for_add_and_change_links(self): + response = self.client.get(reverse("admin:index")) + tests = [ + ("admin_views", "actor"), + ("admin_views", "worker"), + ("auth", "group"), + ("auth", "user"), + ] + for app_label, model_name in tests: + with self.subTest(app_label=app_label, model_name=model_name): + row_id = f"{app_label}-{model_name}" + self.assertContains(response, f'') + self.assertContains( + response, + f'Change', + ) + self.assertContains( + response, + f'Add', + ) + @override_settings( AUTH_PASSWORD_VALIDATORS=[