#24256: No easy way to access the filtered queryset from admin.SimpleListFilter -------------------------------+-------------------- Reporter: tbabej | Owner: nobody Type: New feature | Status: new Component: Uncategorized | Version: 1.7 Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------+-------------------- I have a simple goal - I want to build a admin.SimpleListFilter, which offers in the lookups method only those choices which are relevant to the current user selection.
The lookups() method gets passed the ModelAdmin instance via model_admin argument, however, calling {{{ queryset = model_admin.get_queryset() }}} will return only the unfiltered queryset. There is no easy way how to get the filtered queryset, since that is defined in the ChangeView class, one is only left to duplicate much of the logic of that class to get the filtered queryset. -- Ticket URL: <https://code.djangoproject.com/ticket/24256> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/049.45c768dba667e5972cc59497076937fd%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.