Use dropdowns in Django admin list filter
Project description
django-admin-list-filter-dropdown
A Django admin filter implementation that renders as a dropdown.
If you have more than ten values for a field that you want to filter by in Django admin, the filtering sidebar gets long, cluttered and hard to use.
This app contains the DropdownFilter class that renders as a drop-down in the filtering sidebar to avoid this problem.
Usage
Install:
pip install django-admin-list-filter-dropdown
Enable in settings.py:
INSTALLED_APPS = (
...
'django_admin_listfilter_dropdown',
...
)
Use in admin.py:
from django_admin_listfilter_dropdown.filters import DropdownFilter, RelatedDropdownFilter
class EntityAdmin(admin.ModelAdmin):
...
list_filter = (
# for ordinary fields
('a_charfield', DropdownFilter),
# for related fields
('a_foreignkey_field', RelatedDropdownFilter),
)
Example
Here’s what it looks like:
Credits
Based on this StackOverflow question and code from FeinCMS.
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
Close
Hashes for django-admin-list-filter-dropdown-1.0.0.zip
Algorithm | Hash digest | |
---|---|---|
SHA256 | 763ae48948ac8b179227b209d9bf99bc61e325717882e479440e158bb7ed80c9 |
|
MD5 | 1e44d32741e285ce59157b77df9c24f3 |
|
BLAKE2b-256 | 466cb72656a84e208470688d31ad0fd0ebcc13903901a97e87aacfeffa5fbd5d |