From 9388a4e326f5a683ee72408a519b79332a0c23f9 Mon Sep 17 00:00:00 2001 From: Foucauld Degeorges Date: Fri, 20 Dec 2024 09:44:19 +0100 Subject: [PATCH] formatting --- django/contrib/admin/actions.py | 2 +- django/contrib/admin/sites.py | 5 ++++- tests/admin_views/sites.py | 1 + tests/admin_views/test_adminsite.py | 6 +++++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/django/contrib/admin/actions.py b/django/contrib/admin/actions.py index 3a31f236d5..30ab8c1c61 100644 --- a/django/contrib/admin/actions.py +++ b/django/contrib/admin/actions.py @@ -91,5 +91,5 @@ def delete_selected(modeladmin, request, queryset): "admin/delete_selected_confirmation.html", ], context, - using=modeladmin.admin_site.template_engine + using=modeladmin.admin_site.template_engine, ) diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py index c444ba10a6..40991b7d0f 100644 --- a/django/contrib/admin/sites.py +++ b/django/contrib/admin/sites.py @@ -573,7 +573,10 @@ class AdminSite: request.current_app = self.name return TemplateResponse( - request, self.index_template or "admin/index.html", context, using=self.template_engine + request, + self.index_template or "admin/index.html", + context, + using=self.template_engine, ) def app_index(self, request, app_label, extra_context=None): diff --git a/tests/admin_views/sites.py b/tests/admin_views/sites.py index 38f0d0b264..abe3c517f9 100644 --- a/tests/admin_views/sites.py +++ b/tests/admin_views/sites.py @@ -1,4 +1,5 @@ from django.contrib import admin + class CustomAdminSiteWithCustomTemplateEngine(admin.AdminSite): template_engine = "custom_template_engine" diff --git a/tests/admin_views/test_adminsite.py b/tests/admin_views/test_adminsite.py index 45e874e9b0..5b0a3aa36c 100644 --- a/tests/admin_views/test_adminsite.py +++ b/tests/admin_views/test_adminsite.py @@ -128,6 +128,7 @@ class SiteActionsTests(SimpleTestCase): self.site.disable_action(action_name) self.assertEqual(self.site.get_action(action_name), delete_selected) + class AdminSiteCustomTemplateEngineTests(TestCase): request_factory = RequestFactory() @@ -143,4 +144,7 @@ class AdminSiteCustomTemplateEngineTests(TestCase): request.user = self.user index_response = admin_site.index(request=request) - self.assertEqual(index_response.using, CustomAdminSiteWithCustomTemplateEngine.template_engine) \ No newline at end of file + self.assertEqual( + index_response.using, + CustomAdminSiteWithCustomTemplateEngine.template_engine, + )