diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py
index 806be24..9363aed 100644
a
|
b
|
def items_for_result(cl, result, form):
|
132 | 132 | first = True |
133 | 133 | pk = cl.lookup_opts.pk.attname |
134 | 134 | for field_name in cl.list_display: |
135 | | row_class = '' |
| 135 | row_classes = ['fieldname_%s' % field_name] |
136 | 136 | try: |
137 | 137 | f, attr, value = lookup_field(field_name, result, cl.model_admin) |
138 | 138 | except (AttributeError, ObjectDoesNotExist): |
… |
… |
def items_for_result(cl, result, form):
|
164 | 164 | else: |
165 | 165 | result_repr = display_for_field(value, f) |
166 | 166 | if isinstance(f, models.DateField) or isinstance(f, models.TimeField): |
167 | | row_class = ' class="nowrap"' |
| 167 | row_classes.append('nowrap') |
168 | 168 | if force_unicode(result_repr) == '': |
169 | 169 | result_repr = mark_safe(' ') |
| 170 | row_class = ' class="%s"' % ' '.join(row_classes) |
170 | 171 | # If list_display_links not defined, add the link tag to the first field |
171 | 172 | if (first and not cl.list_display_links) or field_name in cl.list_display_links: |
172 | 173 | table_tag = {True:'th', False:'td'}[first] |
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
index d320db5..2cd70da 100644
a
|
b
|
class AdminViewDeletedObjectsTest(TestCase):
|
1017 | 1017 | response = self.client.get('/test_admin/admin/admin_views/plot/%s/delete/' % quote(3)) |
1018 | 1018 | self.assertContains(response, should_contain) |
1019 | 1019 | |
| 1020 | class AdminChangeListFieldNameClassAttrTest(TestCase): |
| 1021 | fixtures = ['admin-views-users.xml'] |
| 1022 | |
| 1023 | def setUp(self): |
| 1024 | self.client.login(username='super', password='secret') |
| 1025 | |
| 1026 | def tearDown(self): |
| 1027 | self.client.logout() |
| 1028 | |
| 1029 | def test_class_attributes(self): |
| 1030 | "Cells of the change list table should contain the field name in their class attribute" |
| 1031 | Podcast.objects.create(name="Django Dose", |
| 1032 | release_date=datetime.date.today()) |
| 1033 | response = self.client.get('/test_admin/admin/admin_views/podcast/') |
| 1034 | #assert False, response.content |
| 1035 | self.assertContains( |
| 1036 | response, '<td class="fieldname_action_checkbox">') |
| 1037 | self.assertContains( |
| 1038 | response, '<th class="fieldname_name">') |
| 1039 | self.assertContains( |
| 1040 | response, '<td class="fieldname_release_date nowrap">') |
| 1041 | |
1020 | 1042 | class AdminViewStringPrimaryKeyTest(TestCase): |
1021 | 1043 | fixtures = ['admin-views-users.xml', 'string-primary-key.xml'] |
1022 | 1044 | |
… |
… |
class AdminViewStringPrimaryKeyTest(TestCase):
|
1047 | 1069 | def test_changelist_to_changeform_link(self): |
1048 | 1070 | "The link from the changelist referring to the changeform of the object should be quoted" |
1049 | 1071 | response = self.client.get('/test_admin/admin/admin_views/modelwithstringprimarykey/') |
1050 | | should_contain = """<th><a href="%s/">%s</a></th></tr>""" % (quote(self.pk), escape(self.pk)) |
| 1072 | should_contain = """<th class="fieldname___str__"><a href="%s/">%s</a></th></tr>""" % (quote(self.pk), escape(self.pk)) |
1051 | 1073 | self.assertContains(response, should_contain) |
1052 | 1074 | |
1053 | 1075 | def test_recentactions_link(self): |