2
2
from django .contrib import admin
3
3
4
4
5
- class Collapsed :
5
+ class Base :
6
6
"""Mixin class for filters with title, apply button and collapsed state."""
7
7
8
- is_collapsed = False
9
8
parameter_name = 'filter'
10
9
title = None
11
10
@@ -18,16 +17,10 @@ def set_title(self):
18
17
'parameter_name' : self .parameter_name ,
19
18
'filter_name' : self .FILTER_LABEL ,
20
19
'button_label' : self .BUTTON_LABEL ,
21
- 'collapsed' : self .collapsed_state ,
22
20
}
23
21
24
- @property
25
- def collapsed_state (self ):
26
- """Return string for CSS stype."""
27
- return '' if self .is_collapsed else 'open'
28
22
29
-
30
- class Filter (admin .FieldListFilter , Collapsed ):
23
+ class Filter (admin .FieldListFilter , Base ):
31
24
"""Base class for filters applied to field with title, apply button and collapsed state."""
32
25
33
26
parameter_name_mask = 'adminfilter_'
@@ -54,7 +47,7 @@ def choices(self, changelist):
54
47
raise NotImplementedError ('Method choices' )
55
48
56
49
57
- class FilterSimple (admin .SimpleListFilter , Collapsed ):
50
+ class FilterSimple (admin .SimpleListFilter , Base ):
58
51
"""Base class for filters without field with title, apply button and collapsed state."""
59
52
60
53
parameter_name = 'adminfilter'
0 commit comments