7
I don’t have enough reputation to add a comment, so I’ll write here, even if this is not a real answer.
It looks there’s an open ticket on this topic: lookup_allowed fails to consider dynamic list_filter
You can use two different workarounds to quickly solve this problem until it will be fixed upstream:
- in addition to
get_list_filter
you can definelist_filter = ('order__customer',)
, so that this field’s lookups will always be whitelisted, even if not used (because get_list_filter has precedence) -
you can override
lookup_allowed
this way:def lookup_allowed(self, lookup, *args, **kwargs): if lookup == 'order__customer__id__exact': return True return super(TaskAdmin, self).lookup_allowed(lookup, *args, **kwargs)
this explicitly allows the single lookup that will be used as url param.
Source:stackexchange.com