diff --git a/django/contrib/admin/templates/admin/app_list.html b/django/contrib/admin/templates/admin/app_list.html index ea4a85bd0bf..00c4178bd22 100644 --- a/django/contrib/admin/templates/admin/app_list.html +++ b/django/contrib/admin/templates/admin/app_list.html @@ -2,15 +2,15 @@ {% if app_list %} {% for app in app_list %} -
{{ model.name }} | +{{ model.name }} | {% else %}{{ model.name }} | {% endif %} diff --git a/tests/admin_views/models.py b/tests/admin_views/models.py index 36a8423c41f..73459e29954 100644 --- a/tests/admin_views/models.py +++ b/tests/admin_views/models.py @@ -1046,3 +1046,7 @@ class ReadOnlyRelatedField(models.Model): chapter = models.ForeignKey(Chapter, models.CASCADE) language = models.ForeignKey(Language, models.CASCADE) user = models.ForeignKey(User, models.CASCADE) + + +class Héllo(models.Model): + pass diff --git a/tests/admin_views/test_nav_sidebar.py b/tests/admin_views/test_nav_sidebar.py index 04811489a7e..c2e45d91a20 100644 --- a/tests/admin_views/test_nav_sidebar.py +++ b/tests/admin_views/test_nav_sidebar.py @@ -4,6 +4,8 @@ from django.contrib.auth.models import User from django.test import TestCase, override_settings from django.urls import path, reverse +from .models import Héllo + class AdminSiteWithSidebar(admin.AdminSite): pass @@ -17,6 +19,7 @@ site_with_sidebar = AdminSiteWithSidebar(name='test_with_sidebar') site_without_sidebar = AdminSiteWithoutSidebar(name='test_without_sidebar') site_with_sidebar.register(User) +site_with_sidebar.register(Héllo) urlpatterns = [ path('test_sidebar/admin/', site_with_sidebar.urls), @@ -85,9 +88,23 @@ class AdminSidebarTests(TestCase): with self.assertNoLogs('django.template', 'DEBUG'): self.client.get(url) + def test_sidebar_model_name_non_ascii(self): + url = reverse('test_with_sidebar:admin_views_héllo_changelist') + response = self.client.get(url) + self.assertContains(response, '|
---|---|---|---|
' + '' + 'Héllos | ' + ) + @override_settings(ROOT_URLCONF='admin_views.test_nav_sidebar') class SeleniumTests(AdminSeleniumTestCase): + available_apps = ['admin_views'] + AdminSeleniumTestCase.available_apps + def setUp(self): self.superuser = User.objects.create_superuser( username='super',