summaryrefslogtreecommitdiff
path: root/tests/modeladmin
diff options
context:
space:
mode:
authorGreg Chapple <gregchapple1@gmail.com>2014-06-10 10:32:46 +0100
committerTim Graham <timograham@gmail.com>2014-06-10 09:35:05 -0400
commitd8f19bb3b6f858bef499fdab41948a5a5e8d55aa (patch)
treeca3556dfa3dfe2ab1dfff0742d344da276d7312a /tests/modeladmin
parent34f4fd70245c2daee29f9866600c6203c58e25c2 (diff)
downloaddjango-d8f19bb3b6f858bef499fdab41948a5a5e8d55aa.tar.gz
Fixed #22792 -- Updated checks for list_display_links in model admin
Diffstat (limited to 'tests/modeladmin')
-rw-r--r--tests/modeladmin/tests.py24
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)