Django-more-admin-filters is a collection of django admin filters with a focus on filters using dropdown widgets, multiple choice filters and filters working with annotated attributes.
Install from pypi.org:
pip install django-more-admin-filters
Add more_admin_filters to your installed apps:
INSTALLED_APPS = [ 'more_admin_filters', ... ]
Use the filter classes with your ModelAdmin:
from more_admin_filters import MultiSelectDropdownFilter class MyModelAdmin(admin.ModelAdmin): ... list_filter = [ ('myfield', MultiSelectDropdownFilter), ... ]
Since the ModelAdmin routine to initialize the list filters doesn't work with annotated attributes the usage for an annotation filter is a little bit special. The filter class needs to be equipped with the attribute's name:
MyModelAdmin(admin.ModelAdmin): list_filter = [ BooleanAnnotationFilter.init('my_annotated_attribute'), ... ]
- DropdownFilter
- Dropdown filter for all kind of fields.
- ChoicesDropdownFilter
- Dropdown filter for fields using choices.
- RelatedDropdownFilter
- Dropdown filter for relation fields.
- RelatedOnlyDropdownFilter
- Dropdown filter for relation fields using limit_choices_to.
- MultiSelectFilter
- Multi select filter for all kind of fields.
- MultiSelectRelatedFilter
- Multi select filter for relation fields.
- MultiSelectRelatedOnlyFilter
- Multi select filter for related fields with choices limited to the objects involved in that relation.
- MultiSelectDropdownFilter
- Multi select dropdown filter for all kind of fields.
- MultiSelectRelatedDropdownFilter
- Multi select dropdown filter for relation fields.
- MultiSelectRelatedOnlyDropdownFilter
- Multi select dropdown filter for relation fields with choices limited to the objects involved in that relation.
- BooleanAnnotationFilter
- Filter for annotated boolean-attributes.
Note
More kind of annotation filters will be added in future versions.