#32539: Support accessing the current filtered queryset from within
SimpleListFilter.lookups()
--------------------------------+------------------------------------
Reporter: Simon Willison | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: 3.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------
Comment (by Simon Willison):
I'd love to, but I'm a bit stuck on where to begin with this.
Like you, I'm skeptical that this is a simple bug fix. I think there are
two options here:
- A medium-sized change to the architecture of the admin, such that
`.lookups()` no longer gets called when the `ChangeList` is constructed.
I'm not at all sure how much work this would be or if it could be
implemented without breaking existing custom code.
- A new, optional mechanism for people who want to use
`model_admin.get_changelist_instance(request)` inside their `.lookups()`
method - potentially even defining a new `.lazy_options(...)` method that
people can implement which deliberately doesn't get called until later on,
to avoid this `RecursionError`
I'd like it if there was a third option, "just rewrite things in an
invisible way such that this works" - but my hunch is that's not possible.
And the two options I listed above both warrant some discussion with
people who are more familiar with the internals of the admin than I am!
--
Ticket URL: <https://code.djangoproject.com/ticket/32539#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.270394defb722d5fd81bf73b241546b7%40djangoproject.com.