1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #24316 -- Made ModelAdmin.list_display callables use an appropriate CSS class name.

Thanks Berker Peksag for the review.
This commit is contained in:
Tim Graham
2015-12-28 15:31:45 -05:00
parent 1e9150443e
commit 37f7ef41fb
3 changed files with 25 additions and 3 deletions

View File

@@ -344,6 +344,15 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
# started with 3 articles, one was deleted.
self.assertEqual(Section.objects.latest('id').article_set.count(), 2)
def test_change_list_column_field_classes(self):
response = self.client.get(reverse('admin:admin_views_article_changelist'))
# callables display the callable name.
self.assertContains(response, 'column-callable_year')
self.assertContains(response, 'field-callable_year')
# lambdas display as "lambda" + index that they appear in list_display.
self.assertContains(response, 'column-lambda8')
self.assertContains(response, 'field-lambda8')
def test_change_list_sorting_callable(self):
"""
Ensure we can sort on a list_display field that is a callable