diff options
| author | SusanTan <onceuponatimeforever@gmail.com> | 2013-07-30 23:37:54 -0700 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-07-31 06:59:15 -0400 |
| commit | ccf8f1e18f138dae369a2004c83db9704ad52d99 (patch) | |
| tree | a9a4c92263860691921d0d98e81659cc26bc382e | |
| parent | 0674b38ce904aa9d7a629313831ad24be3d8f3e6 (diff) | |
Added a test for AdminSite.app_index_template; refs #8498.
| -rw-r--r-- | tests/admin_views/customadmin.py | 1 | ||||
| -rw-r--r-- | tests/admin_views/tests.py | 6 | ||||
| -rw-r--r-- | tests/templates/custom_admin/app_index.html | 6 |
3 files changed, 13 insertions, 0 deletions
diff --git a/tests/admin_views/customadmin.py b/tests/admin_views/customadmin.py index ed3a3dea7a..f964d6cffb 100644 --- a/tests/admin_views/customadmin.py +++ b/tests/admin_views/customadmin.py @@ -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' diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index fdb5d7d436..8b44d0dcd2 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -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) diff --git a/tests/templates/custom_admin/app_index.html b/tests/templates/custom_admin/app_index.html new file mode 100644 index 0000000000..3dfae814a7 --- /dev/null +++ b/tests/templates/custom_admin/app_index.html @@ -0,0 +1,6 @@ +{% extends "admin/app_index.html" %} + +{% block content %} +Hello from a custom app_index template +{{ block.super }} +{% endblock %} |
