mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #22792 -- Updated checks for list_display_links in model admin
This commit is contained in:
@@ -1518,3 +1518,27 @@ class CustomModelAdminTests(CheckTestCase):
|
||||
validator_class = CustomValidator
|
||||
|
||||
self.assertIsInvalid(CustomModelAdmin, ValidationTestModel, 'error!')
|
||||
|
||||
|
||||
class ListDisplayEditableTests(CheckTestCase):
|
||||
def test_list_display_links_is_none(self):
|
||||
"""
|
||||
list_display and list_editable can contain the same values
|
||||
when list_display_links is None
|
||||
"""
|
||||
class ProductAdmin(ModelAdmin):
|
||||
list_display = ['name', 'slug', 'pub_date']
|
||||
list_editable = list_display
|
||||
list_display_links = None
|
||||
self.assertIsValid(ProductAdmin, ValidationTestModel)
|
||||
|
||||
def test_list_display_same_as_list_editable(self):
|
||||
"""
|
||||
The first item in list_display can be the same as the first
|
||||
in list_editable
|
||||
"""
|
||||
class ProductAdmin(ModelAdmin):
|
||||
list_display = ['name', 'slug', 'pub_date']
|
||||
list_editable = ['name', 'slug']
|
||||
list_display_links = ['pub_date']
|
||||
self.assertIsValid(ProductAdmin, ValidationTestModel)
|
||||
|
||||
Reference in New Issue
Block a user