Opened 16 years ago
Closed 16 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: | no | UI/UX: | no |
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)
Change History (3)
by , 16 years ago
Attachment: | respect-empty-list_display_links.diff added |
---|
comment:1 by , 16 years ago
comment:2 by , 16 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
list_display_links
(like the other options) is a shortcut; use a custom template if they don't go far enough.
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.