Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#17646 closed New feature (fixed)

Create a get_list_filter hook in ModelAdmin

Reported by: rasca Owned by: mateusgondim
Component: contrib.admin Version: master
Severity: Normal Keywords:
Cc: rasca7@…, mmitar@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

This would be useful when for example the queryset is filtered based on a user type and the superuser can see all types. For a superuser one could add a the type field to list_display and list_filter.

Attachments (1)

ticket17646.diff (6.1 KB) - added by mateusgondim 5 years ago.
I created the hook there in options.py and replaced it in another method that was using the property directly.i also added a doc about the new method in the index.txt of admin, and in the section of minor features in release notes.Finally, i added a test in regression tests about that.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 5 years ago by rasca

Maybe also creating hooks for all the remaining ModelAdmin properties.

comment:2 Changed 5 years ago by Julien Phalip

Triage Stage: UnreviewedAccepted

comment:3 Changed 5 years ago by rasca

See also #17006 and #16841

comment:4 Changed 5 years ago by mateusgondim

Owner: changed from nobody to mateusgondim

Changed 5 years ago by mateusgondim

Attachment: ticket17646.diff added

I created the hook there in options.py and replaced it in another method that was using the property directly.i also added a doc about the new method in the index.txt of admin, and in the section of minor features in release notes.Finally, i added a test in regression tests about that.

comment:5 Changed 5 years ago by mateusgondim

Has patch: set

comment:6 Changed 4 years ago by Mitar

Cc: mmitar@… added

comment:7 Changed 4 years ago by frecon

Needs tests: set

comment:8 Changed 4 years ago by frecon

Needs tests: unset

comment:9 Changed 4 years ago by Julien Phalip <jphalip@…>

Resolution: fixed
Status: newclosed

In ae206d78f6d991e1d7ea1c1bb8bd85f4658c0877:

Fixed #17646 -- Added a get_list_filter() method to ModelAdmin. Thanks to rasca for the suggestion and to mateusgondim for the patch.

comment:10 Changed 4 years ago by Julien Phalip <jphalip@…>

In 22ca5bab95d65d0fdec0b6914f9ab96795cfe138:

[1.5.x] Fixed #17646 -- Added a get_list_filter() method to ModelAdmin. Thanks to rasca for the suggestion and to mateusgondim for the patch.
Backport of ae206d78f6d991e

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