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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user