diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py
index d97c36a..e046246 100644
|
a
|
b
|
def items_for_result(cl, result, form):
|
| 137 | 137 | first = True |
| 138 | 138 | pk = cl.lookup_opts.pk.attname |
| 139 | 139 | for field_name in cl.list_display: |
| 140 | | row_class = '' |
| | 140 | row_classes = ['fieldname_%s' % field_name] |
| 141 | 141 | try: |
| 142 | 142 | f = cl.lookup_opts.get_field(field_name) |
| 143 | 143 | except models.FieldDoesNotExist: |
| … |
… |
def items_for_result(cl, result, form):
|
| 193 | 193 | result_repr = capfirst(dateformat.format(field_val, date_format)) |
| 194 | 194 | else: |
| 195 | 195 | result_repr = EMPTY_CHANGELIST_VALUE |
| 196 | | row_class = ' class="nowrap"' |
| | 196 | row_classes.append('nowrap') |
| 197 | 197 | # Booleans are special: We use images. |
| 198 | 198 | elif isinstance(f, models.BooleanField) or isinstance(f, models.NullBooleanField): |
| 199 | 199 | result_repr = _boolean_icon(field_val) |
| … |
… |
def items_for_result(cl, result, form):
|
| 211 | 211 | result_repr = escape(field_val) |
| 212 | 212 | if force_unicode(result_repr) == '': |
| 213 | 213 | result_repr = mark_safe(' ') |
| | 214 | row_class = ' class="%s"' % ' '.join(row_classes) |
| 214 | 215 | # If list_display_links not defined, add the link tag to the first field |
| 215 | 216 | if (first and not cl.list_display_links) or field_name in cl.list_display_links: |
| 216 | 217 | table_tag = {True:'th', False:'td'}[first] |
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
index 8e7010b..c3c5dbd 100644
|
a
|
b
|
class AdminViewPermissionsTest(TestCase):
|
| 577 | 577 | self.failUnlessEqual(logged.object_id, u'1') |
| 578 | 578 | self.client.get('/test_admin/admin/logout/') |
| 579 | 579 | |
| | 580 | class AdminChangeListFieldNameClassAttrTest(TestCase): |
| | 581 | fixtures = ['admin-views-users.xml'] |
| | 582 | |
| | 583 | def setUp(self): |
| | 584 | self.client.login(username='super', password='secret') |
| | 585 | |
| | 586 | def tearDown(self): |
| | 587 | self.client.logout() |
| | 588 | |
| | 589 | def test_class_attributes(self): |
| | 590 | "Cells of the change list table should contain the field name in their class attribute" |
| | 591 | Podcast.objects.create(name="This Week in Django", |
| | 592 | release_date=datetime.date.today()) |
| | 593 | response = self.client.get('/test_admin/admin/admin_views/podcast/') |
| | 594 | self.assertContains( |
| | 595 | response, '<td class="fieldname_action_checkbox">') |
| | 596 | self.assertContains( |
| | 597 | response, '<th class="fieldname_name">') |
| | 598 | self.assertContains( |
| | 599 | response, '<td class="fieldname_release_date nowrap">') |
| | 600 | |
| 580 | 601 | class AdminViewStringPrimaryKeyTest(TestCase): |
| 581 | 602 | fixtures = ['admin-views-users.xml', 'string-primary-key.xml'] |
| 582 | 603 | |
| … |
… |
class AdminViewStringPrimaryKeyTest(TestCase):
|
| 601 | 622 | def test_changelist_to_changeform_link(self): |
| 602 | 623 | "The link from the changelist referring to the changeform of the object should be quoted" |
| 603 | 624 | response = self.client.get('/test_admin/admin/admin_views/modelwithstringprimarykey/') |
| 604 | | should_contain = """<th><a href="%s/">%s</a></th></tr>""" % (quote(self.pk), escape(self.pk)) |
| | 625 | should_contain = """<th class="fieldname___str__"><a href="%s/">%s</a></th></tr>""" % (quote(self.pk), escape(self.pk)) |
| 605 | 626 | self.assertContains(response, should_contain) |
| 606 | 627 | |
| 607 | 628 | def test_recentactions_link(self): |