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.
--
Ticket URL: <https://code.djangoproject.com/ticket/22569>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_docs: => 0
* needs_better_patch: => 0
* type: Uncategorized => Bug
* needs_tests: => 0
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/22569#comment:1>
* status: new => assigned
* owner: nobody => parasgithub
--
Ticket URL: <https://code.djangoproject.com/ticket/22569#comment:2>
* cc: contact@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/22569#comment:3>
* owner: nobody => Simon Meers
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/22569#comment:4>
* has_patch: 0 => 1
Comment:
https://github.com/django/django/pull/8856
--
Ticket URL: <https://code.djangoproject.com/ticket/22569#comment:5>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/22569#comment:6>
* needs_better_patch: 1 => 0
Comment:
I've now got three separate commits for the three tickets involved, and
three pull requests, though perhaps only this
https://github.com/django/django/pull/8904 pull request is needed since it
contains all three commits?
--
Ticket URL: <https://code.djangoproject.com/ticket/22569#comment:7>
* owner: Simon Meers => (none)
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/22569#comment:7>
* cc: Sarah Boyce (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/22569#comment:8>
* owner: (none) => Sarah Boyce
* needs_better_patch: 1 => 0
* status: new => assigned
Comment:
https://github.com/django/django/pull/16759
--
Ticket URL: <https://code.djangoproject.com/ticket/22569#comment:9>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/22569#comment:10>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/22569#comment:11>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/22569#comment:12>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"594fcc2b7427f7baf2cf1a2d7cd2be61467df0c3" 594fcc2]:
{{{
#!CommitTicketReference repository=""
revision="594fcc2b7427f7baf2cf1a2d7cd2be61467df0c3"
Fixed #22569 -- Made ModelAdmin.lookup_allowed() respect
get_list_filter().
Thank you Simon Meers for the initial patch.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/22569#comment:13>