1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

Fixed #26229 -- Improved check for model admin check admin.E124

Refs #22792
This commit is contained in:
Alasdair Nicol
2016-02-29 11:12:25 +00:00
committed by Tim Graham
parent 0223e213dd
commit 65bd053f11
2 changed files with 50 additions and 7 deletions

View File

@@ -806,10 +806,10 @@ class ModelAdminChecks(BaseModelAdminChecks):
id='admin.E123',
)
]
# Check that list_display_links is set, and that the first values of list_editable and list_display are
# not the same. See ticket #22792 for the use case relating to this.
elif (obj.list_display[0] in obj.list_editable and obj.list_display[0] != obj.list_editable[0] and
obj.list_display_links is not None):
# If list_display[0] is in list_editable, check that
# list_display_links is set. See #22792 and #26229 for use cases.
elif (obj.list_display[0] == field_name and not obj.list_display_links
and obj.list_display_links is not None):
return [
checks.Error(
"The value of '%s' refers to the first field in 'list_display' ('%s'), "