This feature request is more or less related to this one.
The idea is to provide much more flexibility in how ListFilter a rendered. Currently, the admin filters a rendered using the admin_list_filter tag which prevents from defining a custom context. This may be a problem if you want to create a complex JS widget for a custom filter.
If ListFilter was a RenderableMixin, it would be able to render itself the same way Forms do.
There is one problem, though: ListFilter is not aware of its ChangeList container until ListFilter.choices is called. So ListFilter.__init__ signature would have to change.
This could be done the following way:
- add a
changelistparameter toListFilter.__init__ - detect if the filter’s
__init__signature features this parameter usinginspect.signature - if not, flag a deprecation warning and set the attribute after creation
- when Django 5 is released, remove this code and use only the new signature.