Django admin provides very basic view for applying filters on List pages but we have several uses cases where we want multi select, multi search, range filtering. These cases include applying filtering on related fields and reverse related fields as well
We explored several packages
but none seems to fit our use cases well without fiddling with base model admin.
Are there alternatives to these ? If creating own custom filters how are you handling such uses cases ? - any ideas / tips / suggestion to start with ?
I did get some idea for search here - https://medium.com/@hakibenita/how-to-add-a-text-filter-to-django-admin-5d1db93772d8
If you mean you want to filter through Boolean fields, go to admin.py and add list_filter in your modelAdmin.
For example:
from django.contrib import admin
class YourModelAdmin(admin.ModelAdmin):
list_filter = [
"first_boolean_field",
"second_bollean_field",
"third_boolean_field"
]
search_fields = (
"field1",
"field2",
)
admin.site.register(YourModel, YourModelAdmin)
list_filter will allow you to filter by Boolean fields multiple times and search_field will allow you search by fields in the tuple.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With