Opened 5 years ago

Closed 5 years ago

#16765 closed Bug (duplicate)

Not showing any list_display_links is possible with Debug=False but not with Debug=True

Reported by: raf.geens@… 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.

Change History (1)

comment:1 Changed 5 years ago by Julien Phalip

Resolution: duplicate
Status: newclosed

The reason why you're not seeing the error when DEBUG is False is because the ModelAdmin 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.

Note: See TracTickets for help on using tickets.
Back to Top