diff options
| author | Greg Chapple <gregchapple1@gmail.com> | 2014-06-10 10:32:46 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-06-10 09:43:24 -0400 |
| commit | d232a5f93f2c0be93b6aa5669e9cba0f328a4a9b (patch) | |
| tree | c77abc21ff37c9f6846df8ac5558056679bab5d9 /tests/modeladmin | |
| parent | e108da65fe7b84a101412cd31e3bda241e373ed6 (diff) | |
[1.7.x] Fixed #22792 -- Updated checks for list_display_links in model admin
Backport of d8f19bb3b6 from master
Diffstat (limited to 'tests/modeladmin')
| -rw-r--r-- | tests/modeladmin/tests.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/modeladmin/tests.py b/tests/modeladmin/tests.py index 1c3a21d374..3f5f378818 100644 --- a/tests/modeladmin/tests.py +++ b/tests/modeladmin/tests.py @@ -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) |
