A generic filter for the django-admin-page based on django-filter.
Project description
Description
Django-admin-filter is a generic form-based filter for the django-admin-page. It is based on django-filter. It provides a flexible and direct way to filter the items of your changelist and to save and reuse your queries.
Installation
Install from pypi.org:
pip install django-admin-filter
Configuration
There are three things you need to do to use a custom filter-form for your model in your admin changelist:
Add django_admin_filter to your INSTALLED_APPS:
INSTALLED_APPS = [ 'django_admin_filter', ... ]
Add the CustomFilter to the list_filter of your ModelAdmin:
from django_admin_filter.filters import CustomFilter class MyAdmin(admin.ModelAdmin): list_filter = [CustomFilter, ...] ...
And setup the filter-class you want to use with your model. This works exactly as described in the django-filter-docs. But to use your filter-class with the django-admin-filter there is one thing to mind: Instead of subclass django_filters.FilterSet:
import django_filters class MyFilter(django_filters.FilterSet): ...
use the AdminFilterSet:
from django_admin_filter.filterset import AdminFilterSet class MyFilter(AdminFilterSet): ...
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_admin_filter-0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c85051c47d258cbed4df8c130cf6da9715a262ba094ffa169f48d71df75bb54e |
|
MD5 | 0ad46162e88937b4cc133614e5da348f |
|
BLAKE2b-256 | 864236f14cc9a685d1a0ba42101e2f97ab59aa1fc914b32197f71224279a07b0 |