Commit d699e3f1 authored by fred's avatar fred

add "any" nonstop zone filter

parent 137b0aea
...@@ -11,7 +11,9 @@ def get_optional_nonstop_zones(): ...@@ -11,7 +11,9 @@ def get_optional_nonstop_zones():
return [('', '')] + get_nonstop_zones() return [('', '')] + get_nonstop_zones()
def get_search_nonstop_zones(): def get_search_nonstop_zones():
return [('', 'All'), ('', '--------------')] + get_nonstop_zones() + [('', '--------------'), ('none', 'None')] return [('', 'All'),
('any', _('Any')),
('', '--------------')] + get_nonstop_zones() + [('', '--------------'), ('none', 'None')]
class UploadTracksForm(forms.Form): class UploadTracksForm(forms.Form):
tracks = forms.FileField(widget=forms.ClearableFileInput( tracks = forms.FileField(widget=forms.ClearableFileInput(
......
...@@ -262,6 +262,8 @@ class SearchView(TemplateView): ...@@ -262,6 +262,8 @@ class SearchView(TemplateView):
from emissions.models import Nonstop from emissions.models import Nonstop
if zone == 'none': if zone == 'none':
queryset = queryset.filter(nonstop_zones=None) queryset = queryset.filter(nonstop_zones=None)
elif zone == 'any':
queryset = queryset.filter(nonstop_zones__isnull=False).distinct()
else: else:
queryset = queryset.filter(nonstop_zones=zone) queryset = queryset.filter(nonstop_zones=zone)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment