File tree 1 file changed +43
-0
lines changed
1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ # django-admin-list-filter-dropdown
2
+
3
+ A Django admin filter implementation that renders as a dropdown.
4
+
5
+ If you have more than ten values for a field that you want to filter by in
6
+ Django admin, the filtering sidebar gets long, cluttered and hard to use.
7
+
8
+ This app contains the ` DropdownFilter ` class that renders as a drop-down in the
9
+ filtering sidebar to avoid this problem.
10
+
11
+ # Usage
12
+
13
+ Install:
14
+
15
+ ``` sh
16
+ pip install git+http://github.com/mrts/django-admin-list-filter-dropdown.git
17
+ ```
18
+
19
+ Enable in ` settings.py ` :
20
+
21
+ ``` py
22
+ INSTALLED_APPS = (
23
+ ...
24
+ ' django_admin_listfilter_dropdown' ,
25
+ ...
26
+ )
27
+
28
+ ```
29
+
30
+ Use in ` admin.py ` :
31
+
32
+ ``` py
33
+ from django_admin_listfilter_dropdown.filters import DropdownFilter
34
+
35
+ class EntityAdmin (admin .ModelAdmin ):
36
+ ...
37
+ list_filter = ((' fieldname' , DropdownFilter),)
38
+ ```
39
+
40
+ # Credits
41
+
42
+ Based on [ this StackOverflow question] ( http://stackoverflow.com/a/20900314/258772 ) and
43
+ [ code from FeinCMS] ( https://github.com/feincms/feincms/blob/master/feincms/templates/admin/filter.html ) .
You can’t perform that action at this time.
0 commit comments