python - django admin list_filter "or" condition -
sorry if question has been answered before, did lot of googling without success.
i know how create custom list_filter
s in admin views (e.g. subclassing simplefilter
).
what like, way (on admin list view) "check" different filters combines them in or formula.
as example, suppose have:
# models.py class foo(models.model): foobar = ... foofie = ... ... # admin.py class fooadmin(admin.modeladmin): list_filter = ( "foobar", "foofie" ) ...
in admin list view generated fooadmin
can take filter records either foobar
or foofie
. there way filter them formula: foobar = x or foofie = y
, x
, y
2 values foobar
, foofie
can assume?
is possible?
i know not possible in django admin views, seems mutual request, wonder if missed understand or read something.
also 3rd party apps allowing welcome. :)
i found 3rd party app now, django-advanced-filters may fit requirement .
it has:
the or field
or additional field added every rule's available fields.
it allows constructing queries or statements. can utilize creating "empty" rule field "between" set of 1 or more rules.
i have run test, add together or field
work. screenshot:
python django filter django-admin django-admin-filters
No comments:
Post a Comment