File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,7 +48,9 @@ class SignalFilter(django_filters.FilterSet):
4848 )
4949 format_type = django_filters .MultipleChoiceFilter (choices = FormatChoices .choices )
5050 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' )
5254 time_type = django_filters .MultipleChoiceFilter (choices = TimeTypeChoices .choices )
5355
5456 def __init__ (self , data , * args , ** kwargs ):
Original file line number Diff line number Diff line change @@ -28,7 +28,10 @@ class SignalFilterForm(forms.ModelForm):
2828 search = forms .CharField (min_length = 3 )
2929 pathogen = forms .ModelChoiceField (queryset = Pathogen .objects .all (), widget = forms .CheckboxSelectMultiple ())
3030 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+ )
3235 time_type = forms .ChoiceField (choices = TimeTypeChoices .choices , widget = forms .CheckboxSelectMultiple ())
3336 geographic_scope = forms .ModelMultipleChoiceField (queryset = GeographicScope .objects .all (), widget = forms .CheckboxSelectMultiple ())
3437 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):
5555 "geographic_scope" : [el for el in self .request .GET .getlist ("geographic_scope" )]
5656 if self .request .GET .get ("geographic_scope" )
5757 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" )],
5959 "time_type" : [el for el in self .request .GET .getlist ("time_type" )],
6060 }
6161 url_params_str = ""
You can’t perform that action at this time.
0 commit comments