lookup_allowed fails to consider dynamic list_filter
|Reported by:||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
lookup_allowed iterates over
self.list_filter to determine valid params. This is technically incorrect since the introduction of
ModelAdmin in 1.5, because it is possible to define a ModelAdmin such that self.list_filter is
get_list_filter yields SimpleListFilter classes.
To correct it, the above code would need to change from:
for filter_item in self.list_filter:
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
In Django itself, that's actually reasonably acceptable as a change, because it's used infrequently - the only place it's actually used is in ChangeList.get_filters, which has access to the request. However, it is overridden in the wild without accept
*args, **kwargs, so it'd not be easy to provide a clean upgrade path.