Opened 7 years ago

Closed 4 years ago

#29232 closed New feature (wontfix)

Add title option for admin filter when providing a field name

Reported by: David Sanders Owned by: pdecol
Component: contrib.admin Version: dev
Severity: Normal 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 generated title for admin filters when the field is on a related model is often times confusing and not usable since it will be the name of the field without any reference to the fact that it's on a related model instead of the main model. When the field has the same name as a field on the main model it appears as a duplicate as far as the user can tell.

This patch expands the existing tuple pattern for a list_filter item to allow the second parameter to be a string which will be used as the title, instead of only allowing a class inheriting from FieldListFilter. This dove-tails nicely with the existing functionality as providing a subclass of FieldListFilter allows you to easily provide a title on the class itself, but the ability to provide just a string to use as a title removes the need to subclass the correct class choice for the field type (which is fragile) and streamlines the process for when you only want to change the title.

Change History (5)

comment:1 by Tim Graham, 7 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Carlton Gibson, 7 years ago

Patch needs improvement: set

comment:3 by pdecol, 5 years ago

Owner: changed from nobody to pdecol
Status: newassigned

comment:4 by pdecol, 5 years ago

Patch needs improvement: unset

comment:5 by Mariusz Felisiak, 4 years ago

Resolution: wontfix
Status: assignedclosed
Triage Stage: AcceptedUnreviewed

Proposed API is really confusing. There is already a clear and easy way to customize a title by subclassing a filter classes. I know that shortcuts are handy but isn't worth the additional complexity to the API. I discussed with Carlton and we agreed to close the ticket as wontfix.

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