You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-7Lines changed: 8 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -117,30 +117,31 @@ The order of the groups is determined by the order of the individual actions: th
117
117
118
118
## Simpler `SimpleListFilter`s
119
119
120
-
Django allows to add extra filters on the Django admin, but even with a `SimpleListFilter`, there are cumbersome to make. We define a `ChoiceListFilter` which can be
121
-
used to make these based on a dictionary, and add a function `adminfilter_factory(..)` to define such classes in a more covenient way.
120
+
Django allows to add extra filters on the Django admin, but even with a `SimpleListFilter`, they are cumbersome to make. We define a `ChoiceListFilter` which can be
121
+
used to make these based on a dictionary, and add a function `adminfilter_factory(..)` to define such classes in a more convenient way.
122
122
123
123
Once can define such simple list filter by working with a dict like:
124
124
125
-
```
125
+
```python3
126
126
from django.db.models import Q
127
-
from django.db.modles.functions import Now
127
+
from django.db.models.functions import Now
128
+
from django_adminlink.admin import ChoiceListFilter
so a dictionary that maps the key of the filter on a 2-tuple with the verbose name as first item, and the Django filter (a `Q` object) as second one. Because it is a dictionary, it is also imppsible to specify the same key twice.
139
+
so a dictionary that maps the key of the filter on a 2-tuple with the verbose name as first item, and the Django filter (a `Q` object) as second one. Because it is a dictionary, it is also impossible to specify the same key twice.
139
140
140
141
We can also define this with the `adminfilter_factory(..)` as follows:
0 commit comments