File tree 3 files changed +8
-3
lines changed
3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,9 @@ class SignalFilter(django_filters.FilterSet):
48
48
)
49
49
format_type = django_filters .MultipleChoiceFilter (choices = FormatChoices .choices )
50
50
severenity_pyramid_rungs = django_filters .MultipleChoiceFilter (choices = SeverityPyramidRungsChoices .choices )
51
- source = django_filters .ModelMultipleChoiceFilter (queryset = SourceSubdivision .objects .all ())
51
+ source = django_filters .ModelMultipleChoiceFilter (queryset = SourceSubdivision .objects .all (),
52
+ field_name = "source_id__external_name" ,
53
+ to_field_name = 'external_name' )
52
54
time_type = django_filters .MultipleChoiceFilter (choices = TimeTypeChoices .choices )
53
55
54
56
def __init__ (self , data , * args , ** kwargs ):
Original file line number Diff line number Diff line change @@ -28,7 +28,10 @@ class SignalFilterForm(forms.ModelForm):
28
28
search = forms .CharField (min_length = 3 )
29
29
pathogen = forms .ModelChoiceField (queryset = Pathogen .objects .all (), widget = forms .CheckboxSelectMultiple ())
30
30
active = forms .TypedMultipleChoiceField (choices = ActiveChoices .choices , coerce = bool , widget = forms .CheckboxSelectMultiple ())
31
- source = forms .MultipleChoiceField (choices = SourceSubdivision .objects .values_list ('id' , 'external_name' ), widget = forms .CheckboxSelectMultiple ())
31
+ source = forms .MultipleChoiceField (
32
+ choices = set (SourceSubdivision .objects .values_list ('external_name' , 'external_name' )),
33
+ widget = forms .CheckboxSelectMultiple ()
34
+ )
32
35
time_type = forms .ChoiceField (choices = TimeTypeChoices .choices , widget = forms .CheckboxSelectMultiple ())
33
36
geographic_scope = forms .ModelMultipleChoiceField (queryset = GeographicScope .objects .all (), widget = forms .CheckboxSelectMultiple ())
34
37
severenity_pyramid_rungs = forms .ChoiceField (choices = SeverityPyramidRungsChoices .choices , widget = forms .CheckboxSelectMultiple ())
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ def get_url_params(self):
55
55
"geographic_scope" : [el for el in self .request .GET .getlist ("geographic_scope" )]
56
56
if self .request .GET .get ("geographic_scope" )
57
57
else None ,
58
- "source" : [int ( el ) for el in self .request .GET .getlist ("source" )],
58
+ "source" : [el for el in self .request .GET .getlist ("source" )],
59
59
"time_type" : [el for el in self .request .GET .getlist ("time_type" )],
60
60
}
61
61
url_params_str = ""
You can’t perform that action at this time.
0 commit comments