Loading tests/admin_views/customadmin.py +1 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ from . import models, forms, admin as base_admin class Admin2(admin.AdminSite): app_index_template = 'custom_admin/app_index.html' login_form = forms.CustomAdminAuthenticationForm login_template = 'custom_admin/login.html' logout_template = 'custom_admin/logout.html' Loading tests/admin_views/tests.py +6 −0 Original line number Diff line number Diff line Loading @@ -806,6 +806,12 @@ class CustomModelAdminTest(AdminViewBasicTestCase): self.assertTemplateUsed(response, 'custom_admin/index.html') self.assertContains(response, 'Hello from a custom index template *bar*') def testCustomAdminSiteAppIndexViewandTemplate(self): response = self.client.get('/test_admin/admin2/admin_views/') self.assertIsInstance(response, TemplateResponse) self.assertTemplateUsed(response, 'custom_admin/app_index.html') self.assertContains(response, 'Hello from a custom app_index template') def testCustomAdminSitePasswordChangeTemplate(self): response = self.client.get('/test_admin/admin2/password_change/') self.assertIsInstance(response, TemplateResponse) Loading tests/templates/custom_admin/app_index.html 0 → 100644 +6 −0 Original line number Diff line number Diff line {% extends "admin/app_index.html" %} {% block content %} Hello from a custom app_index template {{ block.super }} {% endblock %} Loading
tests/admin_views/customadmin.py +1 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ from . import models, forms, admin as base_admin class Admin2(admin.AdminSite): app_index_template = 'custom_admin/app_index.html' login_form = forms.CustomAdminAuthenticationForm login_template = 'custom_admin/login.html' logout_template = 'custom_admin/logout.html' Loading
tests/admin_views/tests.py +6 −0 Original line number Diff line number Diff line Loading @@ -806,6 +806,12 @@ class CustomModelAdminTest(AdminViewBasicTestCase): self.assertTemplateUsed(response, 'custom_admin/index.html') self.assertContains(response, 'Hello from a custom index template *bar*') def testCustomAdminSiteAppIndexViewandTemplate(self): response = self.client.get('/test_admin/admin2/admin_views/') self.assertIsInstance(response, TemplateResponse) self.assertTemplateUsed(response, 'custom_admin/app_index.html') self.assertContains(response, 'Hello from a custom app_index template') def testCustomAdminSitePasswordChangeTemplate(self): response = self.client.get('/test_admin/admin2/password_change/') self.assertIsInstance(response, TemplateResponse) Loading
tests/templates/custom_admin/app_index.html 0 → 100644 +6 −0 Original line number Diff line number Diff line {% extends "admin/app_index.html" %} {% block content %} Hello from a custom app_index template {{ block.super }} {% endblock %}