Opened 9 years ago
Last modified 9 years ago
#24947 new New feature
Move admin changelist filters into a separate class (Mixin)
Reported by: | Emmanuelle Delescolle | Owned by: | Emmanuelle Delescolle |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Normal | Keywords: | admin changelist filter |
Cc: | Marc Tamlyn | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
As suggested by @mjtamlyn at DjangoConEurope, move admin changelist filters into a separate class, so that it is usable both by the admin and CBV's.
I am thinking of creating first 2, then 3 mixins:
- a BaseListFilter mixin holding most of the logic of filtering
- an AdminFilter mixin (extending BaseListFilter) with admin changelist specifics
- finally a FilteredList Mixin (extending BaseListFilter) to use with CBV's
Change History (2)
comment:1 by , 9 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 9 years ago
Note:
See TracTickets
for help on using tickets.
Maybe we should make this ticket a subticket of a bigger feature "Give Class Based Views (CBV) more admin functionality" or "Re-use admin code so that users can use it in CBV - like actions, filters or inlines". I think the advance of is this approach is that when we give the class based views (CBV) more functionality, 3th party projects are going to build "better" admin apps and Django can re-use the code to slowly transfer the admin to the new views.
One thing that I all ready found is that ListFilter need a ChangList to render the url for each option. So you can make a ListView that uses a one or more ListFilters in the CBV only when you want to render it you suddenly need a ChangList.
Maybe it's a better idea to start a Group Discussion for this subject.