[3.1.x] Fixed #31865 -- Adjusted admin nav sidebar template to reduce debug logging.

Thanks to Mariusz Felisiak for review.

Backport of 0aeb802cf0 from master
This commit is contained in:
Carlton Gibson 2020-08-11 10:11:42 +02:00
parent daf4f70eae
commit 02b474f2a4
3 changed files with 12 additions and 1 deletions

View File

@ -1,5 +1,5 @@
{% load i18n %}
<button class="sticky toggle-nav-sidebar" id="toggle-nav-sidebar" aria-label="{% translate 'Toggle navigation' %}"></button>
<nav class="sticky" id="nav-sidebar">
{% include 'admin/app_list.html' with app_list=available_apps %}
{% include 'admin/app_list.html' with app_list=available_apps show_changelinks=False %}
</nav>

View File

@ -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`).

View File

@ -77,6 +77,14 @@ class AdminSidebarTests(TestCase):
self.assertContains(response, '<a href="%s">Users</a>' % 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):