Django admin: Filter many different relationships independently

Currently, with a view of the Django admin, I can filter groups like

http://127.0.0.1:8000/admin/accounts/user/?groups__exact=1

to get all users in group 1 or

http://127.0.0.1:8000/admin/accounts/user/?groups__in=1,2,3

to get all users in a group of 1,2 or 3.

How to filter users

  • which are not in group 1, or
  • which are in groups 2 and 3, but not 4.

Ideally, Id should run them using independent URL parameters, for example. sort of

http://127.0.0.1:8000/admin/accounts/user/?groups__1=1&groups__2=1&groups__3=0
+4
source share
1 answer

Try to implement your own admin filter, here is a simple example: http://djangotricks.blogspot.com/2011/11/custom-admin-filter-specification.html

+1
source

All Articles