id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux
22569,lookup_allowed fails to consider dynamic list_filter,Keryn Knight ,nobody,"Currently, `lookup_allowed` iterates over `self.list_filter` to determine valid params. This is technically incorrect since the introduction of `get_list_filter()` on `ModelAdmin` in 1.5, because it is possible to define a ModelAdmin such that self.list_filter is `()` but `get_list_filter` yields SimpleListFilter classes.
To correct it, the above code would need to change from:
{{{
for filter_item in self.list_filter:
}}}
to
{{{
for filter_item in self.get_list_filter(request):
}}}
The problem is that now `lookup_allowed` needs to accept `request` so that it can pass it back to `get_list_filter`
In Django itself, that's actually reasonably acceptable as a change, because [https://github.com/django/django/search?q=lookup_allowed&ref=cmdform it's used infrequently] - the only place it's actually used is in [https://github.com/django/django/blob/274048351ae2fc35995645a6dad7c98f74f51eb1/django/contrib/admin/views/main.py#L96 ChangeList.get_filters], which has access to the request. However, it is overridden [https://sourcegraph.com/search?page=1&per_page=100&q=lookup_allowed in the wild] without accept `*args, **kwargs`, so it'd not be easy to provide a clean upgrade path.",Bug,new,contrib.admin,master,Normal,,,contact@…,Accepted,0,0,0,0,0,0