From 0aeb802cf054cb369646c871b53c93a83c1fa58a Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Tue, 11 Aug 2020 10:11:42 +0200 Subject: [PATCH] Fixed #31865 -- Adjusted admin nav sidebar template to reduce debug logging. Thanks to Mariusz Felisiak for review. --- django/contrib/admin/templates/admin/nav_sidebar.html | 2 +- docs/releases/3.1.1.txt | 3 +++ tests/admin_views/test_nav_sidebar.py | 8 ++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/django/contrib/admin/templates/admin/nav_sidebar.html b/django/contrib/admin/templates/admin/nav_sidebar.html index 9fde4c28e1..32c5b8f839 100644 --- a/django/contrib/admin/templates/admin/nav_sidebar.html +++ b/django/contrib/admin/templates/admin/nav_sidebar.html @@ -1,5 +1,5 @@ {% load i18n %} diff --git a/docs/releases/3.1.1.txt b/docs/releases/3.1.1.txt index c8201d4e41..c777b3cc60 100644 --- a/docs/releases/3.1.1.txt +++ b/docs/releases/3.1.1.txt @@ -17,3 +17,6 @@ Bugfixes * Fixed encoding session data while upgrading multiple instances of the same project to Django 3.1 (:ticket:`31864`). + +* Adjusted admin's navigation sidebar template to reduce debug logging when + rendering (:ticket:`31865`). diff --git a/tests/admin_views/test_nav_sidebar.py b/tests/admin_views/test_nav_sidebar.py index 01cd4cfee7..b3d4955b19 100644 --- a/tests/admin_views/test_nav_sidebar.py +++ b/tests/admin_views/test_nav_sidebar.py @@ -77,6 +77,14 @@ class AdminSidebarTests(TestCase): self.assertContains(response, 'Users' % url) self.assertNotContains(response, 'aria-current') + @override_settings(DEBUG=True) + def test_included_app_list_template_context_fully_set(self): + # All context variables should be set when rendering the sidebar. + url = reverse('test_with_sidebar:auth_user_changelist') + with self.assertRaisesMessage(AssertionError, 'no logs'): + with self.assertLogs('django.template', 'DEBUG'): + self.client.get(url) + @override_settings(ROOT_URLCONF='admin_views.test_nav_sidebar') class SeleniumTests(AdminSeleniumTestCase):