sorry if this question has been answered before, but I did a lot of googling without success.
I know how to create custom list_filter
s in admin views (e.g. subclassing SimpleFilter
).
What I really would like, is a way (on the admin list view) to "check" different filters that combines them in a OR formula.
As an example, suppose you have:
# models.py
class Foo(models.Model):
foobar = ...
foofie = ...
...
# admin.py
class FooAdmin(admin.ModelAdmin):
list_filter = ( "foobar", "foofie" )
...
In the admin list view generated by FooAdmin
I can choose to filter records either by foobar
or by foofie
. Is there a way to filter them by the formula: foobar = X OR foofie = Y
, where X
and Y
are two values that foobar
and foofie
can assume?
Is it even possible?
I know not everything is possible in the django admin views, but it seems a very common request, I wonder if I missed to understand or read something.
Also third party apps allowing it are welcome. Thanks :)
I found a third party app just now, it is django-advanced-filters which may fit you requirement .
It has:
I have run a test, add a
OR field
would work. This is the screenshot: