1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

formatting

This commit is contained in:
Foucauld Degeorges 2024-12-20 09:44:19 +01:00
parent b06eeb75dd
commit 9388a4e326
4 changed files with 11 additions and 3 deletions

View File

@ -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,
)

View File

@ -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):

View File

@ -1,4 +1,5 @@
from django.contrib import admin
class CustomAdminSiteWithCustomTemplateEngine(admin.AdminSite):
template_engine = "custom_template_engine"

View File

@ -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)
self.assertEqual(
index_response.using,
CustomAdminSiteWithCustomTemplateEngine.template_engine,
)