Opened 13 years ago
Closed 13 years ago
#16765 closed Bug (duplicate)
Not showing any list_display_links is possible with Debug=False but not with Debug=True
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | contrib.admin | Version: | 1.3 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I had made a ModelAdmin object where using list_editable it was possible to edit objects directly on the change list page. Since I didn't particularly needed being able to edit each object on a separate page, I wanted list_display_links to be empty. When I assigned [None] to it I got the desired behaviour.
However, this only works when Debug = False in settings.py. If Debug = True, I'll get a "iteration over non-sequence
'ConfigAdmin.list_display_links[0]' refers to 'None' which is not defined in 'list_display'." exception from admin.site.register , which is what I'd expect given list_display_links's documentation.
I think either the exception should be raised as well with Debug = False, or list_display_links should be allowed to be empty.
The reason why you're not seeing the error when
DEBUG
isFalse
is because theModelAdmin
validation only occurs in debug mode (for performance reasons).As for disabling
list_display_links
, this is already being discussed in #15185, so I'm closing this one as duplicate.