Code

Opened 5 years ago

Closed 5 years ago

#9654 closed (wontfix)

`list_display_links` does not respect an empty tuple.

Reported by: mdh Owned by: nobody
Component: contrib.admin Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The admin's change list page will link the first column to the change page for each item even if you explicitly specify an empty tuple as the value of list_display_links. Although it is unusual not to want any of the columns to link to the default change page, this can come up if you are using other extensions to the admin to build a custom interface for a given model. The underlying issue is very easy to address: it arises because the admin uses an empty tuple as the default value, when it could just as easily have used None as the default value instead.

I've attached a simple patch. It's not obvious to me how to test this with the test fixtures currently available, so I haven't written any tests. If people like this but think it needs tests and can give me a hint about how to approach them I'd be happy to write them.

Attachments (1)

respect-empty-list_display_links.diff (1.9 KB) - added by mdh 5 years ago.

Download all attachments as: .zip

Change History (3)

Changed 5 years ago by mdh

comment:1 Changed 5 years ago by kmtracey

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Not sure I'd say I like the idea -- the use case is still a bit vague to me -- but stuff like this can be tested. Look in regressiontests/admin_views, there are tests there that request admin pages and check the response to make sure it has some text, or doesn't have some text, has ordered items in a particular way, etc.

comment:2 Changed 5 years ago by jacob

  • Resolution set to wontfix
  • Status changed from new to closed

list_display_links (like the other options) is a shortcut; use a custom template if they don't go far enough.

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.