diff options
author | Arne Brodowski <mail@arnebrodowski.de> | 2014-01-24 14:35:17 +0100 |
---|---|---|
committer | Baptiste Mispelon <bmispelon@gmail.com> | 2014-01-24 17:40:24 +0100 |
commit | 38be3cf5e4c4980b484e1013c2a4047725ba8d3e (patch) | |
tree | f5c544fafd3ba9089e6aadc3c7befcbd677e9154 /tests/admin_checks | |
parent | e1d18b9d2e8ac292940f070b0a8cb9733756acd9 (diff) | |
download | django-38be3cf5e4c4980b484e1013c2a4047725ba8d3e.tar.gz |
Fixed #21870 -- Admin check for list_editable_item
During the admin check for list_editable _check_list_editable_item
should return an empty list if all checks pass. Additionally the
Testcase test_readonly_and_editable was changed to test what the
name implies instead of duplicating the logic of test_readonly.
Diffstat (limited to 'tests/admin_checks')
-rw-r--r-- | tests/admin_checks/tests.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/admin_checks/tests.py b/tests/admin_checks/tests.py index 934e3f391e..c0ce428e67 100644 --- a/tests/admin_checks/tests.py +++ b/tests/admin_checks/tests.py @@ -52,6 +52,30 @@ class SystemChecksTestCase(TestCase): def test_readonly_and_editable(self): class SongAdmin(admin.ModelAdmin): readonly_fields = ["original_release"] + list_display = ["pk", "original_release"] + list_editable = ["original_release"] + fieldsets = [ + (None, { + "fields": ["title", "original_release"], + }), + ] + + errors = SongAdmin.check(model=Song) + expected = [ + checks.Error( + ('"list_editable[0]" refers to field "original_release", ' + 'whih is not editable through the admin.'), + hint=None, + obj=SongAdmin, + id='admin.E126', + ) + ] + self.assertEqual(errors, expected) + + def test_editable(self): + class SongAdmin(admin.ModelAdmin): + list_display = ["pk", "title"] + list_editable = ["title"] fieldsets = [ (None, { "fields": ["title", "original_release"], |