Collection of extra filters for the Django admin site
Demo can be found at https://django-adminfilters.herokuapp.com/demo/artist/
adminfilters.mp4
- Autocomplete
- AutocompleteFilter
- Simple
- ValueFilter
- Combobox
- AllValuesComboFilter
- RelatedFieldComboFilter
- ChoicesFieldComboFilter
- Dates
- DateRangeFilter
- Radio
- AllValuesRadioFilter
- RelatedFieldRadioFilter
- ChoicesFieldRadioFilter
- BooleanRadioFilter
- Checkbox
- RelatedFieldCheckBoxFilter
- Multiple
- MultiValueFilter
- ManyToMany
- IntersectionFieldListFilter
- UnionFieldListFilter
- JSON
- JsonFieldFilter
- Number
- NumberFilter
- Special
- QueryStringFilter
- DjangoLookupFilter
- PermissionPrefixFilter
Filters management (save/retrieve), is handled by an optional application adminfilters.depot
that,
due to the Django filters internal design, it uses GET method to save filter definition to the database.
When you use FilterDepotManager
to save a filter, the call is idempotent but not safe.
class MyModel(models.Model):
index = models.CharField(max_length=255)
name = models.CharField(max_length=255)
age = models.IntegerField()
flag = models.CharField(default="1", choices=(("0", "Flag 1"), ("1", "Flag 2"))
household = models.ForeignKey("Household")
custom = JSONField(default=dict, blank=True)
class MyModelAdmin(ModelAdmin):
list_filter = (
FilterDepotManager, # needs `adminfilters.depot` app
QueryStringFilter,
DjangoLookupFilter,
("custom", JsonFieldFilter.factory(can_negate=False, options=True)),
("flag", ChoicesFieldComboFilter),
("household", AutoCompleteFilter)
("name", ValueFilter.factory(lookup="istartswith"),
("age", NumberFilter),
)
git clone https://github.com/saxix/django-adminfilters.git
cd django-adminfilters
python3 -m venv .venv
source .venv/bin/activate
make develop
make demo
- Project home page: https://github.com/saxix/django-adminfilters
- Download: http://pypi.python.org/pypi/django-adminfilters/
- Documentation: https://django-adminfilters.readthedocs.io/en/latest/