Documenting URL params filter behavior with ModelAdmin.lookup_allowed()

215 views
Skip to first unread message

Silvio

unread,
Feb 5, 2021, 2:24:06 PM2/5/21
to Django developers (Contributions to Django itself)
Hi all,

I recently removed a filter from an admin change list view, but refreshed the page and to my surprise: the filter still worked!

I thought I stumbled upon a bug, but upon closer inspection, this is the correct behavior. That is, by default, the Django admin allows you to filter pretty much on any field in the model. Possibly even related fields too. The filters on the right are just UX conveniences.

I hold no strong opinion on whether this is a good idea or not. It's certainly convenient for craftier users. But I think we could do a better job documenting this. The *only* mention I could find on this is ModelAdmin.lookup_allowed here: https://docs.djangoproject.com/en/3.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin.lookup_allowed

This sort of hints at the feature, and that you could turn it off by overriding etc. But there's no other mention of it on the page.

Should we make it clearer?

Thank you all. Been using Django for 12 years and never been happier.

Best,

Silvio

Adam Johnson

unread,
Feb 5, 2021, 2:35:34 PM2/5/21
to django-d...@googlegroups.com
Yes this sounds like it's worth documenting. Perhaps there could even be a hint in the UI. In my experience admin "power users" end up discovering this feature by accident.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/5065d98e-1944-4336-9206-00b602e27a4an%40googlegroups.com.


--
Adam
Reply all
Reply to author
Forward
0 new messages