diff --git a/django/contrib/admin/templates/admin/edit_inline/tabular.html b/django/contrib/admin/templates/admin/edit_inline/tabular.html
index 71b097e..b891a76 100644
a
|
b
|
|
44 | 44 | {% for fieldset in inline_admin_form %} |
45 | 45 | {% for line in fieldset %} |
46 | 46 | {% for field in line %} |
47 | | <td class="{{ field.field.name }}"> |
| 47 | <td{% if field.field.name %} class="field-{{ field.field.name }}"{% endif %}> |
48 | 48 | {% if field.is_readonly %} |
49 | 49 | <p>{{ field.contents }}</p> |
50 | 50 | {% else %} |
diff --git a/django/contrib/admin/templates/admin/includes/fieldset.html b/django/contrib/admin/templates/admin/includes/fieldset.html
index 6363aee..0b71d50 100644
a
|
b
|
|
4 | 4 | <div class="description">{{ fieldset.description|safe }}</div> |
5 | 5 | {% endif %} |
6 | 6 | {% for line in fieldset %} |
7 | | <div class="form-row{% if line.fields|length_is:'1' and line.errors %} errors{% endif %}{% for field in line %} {{ field.field.name }}{% endfor %}"> |
| 7 | <div class="form-row{% if line.fields|length_is:'1' and line.errors %} errors{% endif %}{% for field in line %}{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% endfor %}"> |
8 | 8 | {% if line.fields|length_is:'1' %}{{ line.errors }}{% endif %} |
9 | 9 | {% for field in line %} |
10 | 10 | <div{% if not line.fields|length_is:'1' %} class="field-box{% if not field.is_readonly and field.errors %} errors{% endif %}"{% endif %}> |
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
index b6e7b9e..b15e97a 100644
a
|
b
|
class ReadonlyTest(TestCase):
|
2786 | 2786 | formats.localize(datetime.date.today() - datetime.timedelta(days=7)) |
2787 | 2787 | ) |
2788 | 2788 | |
2789 | | self.assertContains(response, '<div class="form-row coolness">') |
2790 | | self.assertContains(response, '<div class="form-row awesomeness_level">') |
2791 | | self.assertContains(response, '<div class="form-row posted">') |
2792 | | self.assertContains(response, '<div class="form-row value">') |
2793 | | self.assertContains(response, '<div class="form-row ">') |
| 2789 | self.assertContains(response, '<div class="form-row field-coolness">') |
| 2790 | self.assertContains(response, '<div class="form-row field-awesomeness_level">') |
| 2791 | self.assertContains(response, '<div class="form-row field-posted">') |
| 2792 | self.assertContains(response, '<div class="form-row field-value">') |
| 2793 | self.assertContains(response, '<div class="form-row">') |
2794 | 2794 | self.assertContains(response, '<p class="help">', 3) |
2795 | 2795 | self.assertContains(response, '<p class="help">Some help text for the title (with unicode ŠĐĆŽćžšđ)</p>') |
2796 | 2796 | self.assertContains(response, '<p class="help">Some help text for the content (with unicode ŠĐĆŽćžšđ)</p>') |
… |
… |
class GroupAdminTest(TestCase):
|
2983 | 2983 | self.assertEqual(response.status_code, 200) |
2984 | 2984 | |
2985 | 2985 | |
| 2986 | class CSSTest(TestCase): |
| 2987 | urls = "regressiontests.admin_views.urls" |
| 2988 | fixtures = ['admin-views-users.xml'] |
| 2989 | |
| 2990 | def setUp(self): |
| 2991 | self.client.login(username='super', password='secret') |
| 2992 | |
| 2993 | def tearDown(self): |
| 2994 | self.client.logout() |
| 2995 | |
| 2996 | def test_css_classes(self): |
| 2997 | response = self.client.get('/test_admin/admin/admin_views/post/add/') |
| 2998 | |
| 2999 | # The main form |
| 3000 | self.assertContains(response, 'class="form-row field-title"') |
| 3001 | self.assertContains(response, 'class="form-row field-content"') |
| 3002 | self.assertContains(response, 'class="form-row field-public"') |
| 3003 | self.assertContains(response, 'class="form-row field-awesomeness_level"') |
| 3004 | self.assertContains(response, 'class="form-row field-coolness"') |
| 3005 | self.assertContains(response, 'class="form-row field-value"') |
| 3006 | self.assertContains(response, 'class="form-row"') # The lambda function |
| 3007 | |
| 3008 | # The tabular inline |
| 3009 | self.assertContains(response, '<td class="field-url">') |
| 3010 | self.assertContains(response, '<td class="field-posted">') |
| 3011 | |
| 3012 | |
2986 | 3013 | try: |
2987 | 3014 | import docutils |
2988 | 3015 | except ImportError: |