Code

Opened 3 years ago

Closed 3 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.

Attachments (0)

Change History (1)

comment:1 Changed 3 years ago by julien

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.