mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #13629 -- Added CSS classes to the <body> tag of some admin templates to allow style customizations per app or per model.
This commit is contained in:
committed by
Julien Phalip
parent
11b7b9ad00
commit
bb145e2c47
@@ -3824,6 +3824,59 @@ class CSSTest(TestCase):
|
||||
self.assertContains(response, '<tr class="model-actor">')
|
||||
self.assertContains(response, '<tr class="model-album">')
|
||||
|
||||
def testAppModelInFormBodyClass(self):
|
||||
"""
|
||||
Ensure app and model tag are correcly read by change_form template
|
||||
"""
|
||||
response = self.client.get('/test_admin/admin/admin_views/section/add/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response,
|
||||
'<body class="app-admin_views model-section ')
|
||||
|
||||
def testAppModelInListBodyClass(self):
|
||||
"""
|
||||
Ensure app and model tag are correcly read by change_list template
|
||||
"""
|
||||
response = self.client.get('/test_admin/admin/admin_views/section/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response,
|
||||
'<body class="app-admin_views model-section ')
|
||||
|
||||
def testAppModelInDeleteConfirmationBodyClass(self):
|
||||
"""
|
||||
Ensure app and model tag are correcly read by delete_confirmation
|
||||
template
|
||||
"""
|
||||
response = self.client.get(
|
||||
'/test_admin/admin/admin_views/section/1/delete/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response,
|
||||
'<body class="app-admin_views model-section ')
|
||||
|
||||
def testAppModelInAppIndexBodyClass(self):
|
||||
"""
|
||||
Ensure app and model tag are correcly read by app_index template
|
||||
"""
|
||||
response = self.client.get('/test_admin/admin/admin_views/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, '<body class="app-admin_views ')
|
||||
|
||||
def testAppModelInDeleteSelectedConfirmationBodyClass(self):
|
||||
"""
|
||||
Ensure app and model tag are correcly read by
|
||||
delete_selected_confirmation template
|
||||
"""
|
||||
action_data = {
|
||||
ACTION_CHECKBOX_NAME: [1],
|
||||
'action': 'delete_selected',
|
||||
'index': 0,
|
||||
}
|
||||
response = self.client.post('/test_admin/admin/admin_views/section/',
|
||||
action_data)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response,
|
||||
'<body class="app-admin_views model-section ')
|
||||
|
||||
try:
|
||||
import docutils
|
||||
except ImportError:
|
||||
|
||||
Reference in New Issue
Block a user