File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 10
10
)
11
11
from django_filters .widgets import QueryArrayWidget
12
12
13
- from signals .models import Signal
13
+ from signals .models import Signal , TimeLabelChoices
14
14
15
15
16
16
class NumberInFilter (BaseInFilter , NumberFilter ):
@@ -22,7 +22,11 @@ class SignalFilter(django_filters.FilterSet):
22
22
FilterSet for the Signal model.
23
23
"""
24
24
25
- id = NumberInFilter (field_name = 'id' , lookup_expr = 'in' , widget = QueryArrayWidget )
25
+ id = NumberInFilter (
26
+ field_name = 'id' ,
27
+ lookup_expr = 'in' ,
28
+ widget = QueryArrayWidget
29
+ )
26
30
search = CharFilter (method = 'filter_search' )
27
31
order_by = OrderingFilter (
28
32
fields = (
@@ -31,6 +35,9 @@ class SignalFilter(django_filters.FilterSet):
31
35
('last_updated' , 'last_updated' ),
32
36
)
33
37
)
38
+ time_label = django_filters .MultipleChoiceFilter (
39
+ choices = TimeLabelChoices .choices ,
40
+ )
34
41
35
42
class Meta :
36
43
model = Signal
Original file line number Diff line number Diff line change @@ -18,9 +18,9 @@ class SignalFilterForm(forms.ModelForm):
18
18
id = forms .ModelMultipleChoiceField (queryset = Signal .objects .all (), widget = forms .MultipleHiddenInput )
19
19
order_by = forms .ChoiceField (choices = [
20
20
('' , '---------' ),
21
- ('name' , 'Name' ),
22
- ('source__name' , 'Source' ),
23
- ('last_updated' , 'Last Updated' ),
21
+ ('name' , _ ( 'Name' ) ),
22
+ ('source__name' , _ ( 'Source' ) ),
23
+ ('last_updated' , _ ( 'Last Updated' ) ),
24
24
],
25
25
required = False ,
26
26
)
@@ -53,7 +53,7 @@ class Meta:
53
53
'id' : 'order_by' ,
54
54
'aria-label' : 'Order by' ,
55
55
}),
56
- 'search' : forms .TextInput (attrs = {'class' : 'form-control' , 'placeholder' : 'Enter search term' }),
56
+ 'search' : forms .TextInput (attrs = {'class' : 'form-control' , 'placeholder' : _ ( 'Enter search term' ) }),
57
57
'available_geography' : forms .CheckboxSelectMultiple (attrs = {
58
58
'class' : 'form-select' ,
59
59
'data-bs-toggle' : 'tooltip' ,
You canโt perform that action at this time.
0 commit comments