[README] added a hint for the usage of annotation filters

django-5.0
Thomas Leichtfuß 2021-05-28 07:49:02 +02:00
parent 64ad89a50d
commit a8baebe321
1 changed files with 11 additions and 0 deletions

View File

@ -45,8 +45,19 @@ Use the filter classes with your ModelAdmin::
...
list_filter = [
('myfield', MultiSelectDropdownFilter),
...
]
Since the ModelAdmin routine to initialize the list filters doesn't work with
annotated attributes the usage for an annotation filter is a little bit special.
The filter class needs to be equipped with the attribute's name::
MyModelAdmin(admin.ModelAdmin):
list_filter = [
BooleanAnnotationFilter.init('my_annotated_attribute'),
...
]
Filter classes
==============