diff --git a/crowdsourcer/filters.py b/crowdsourcer/filters.py index eb56c07..f43cc45 100644 --- a/crowdsourcer/filters.py +++ b/crowdsourcer/filters.py @@ -2,7 +2,7 @@ import django_filters -from crowdsourcer.models import ResponseType +from crowdsourcer.models import ResponseType, Section def filter_not_empty(queryset, name, value): @@ -17,6 +17,12 @@ class VolunteerFilter(django_filters.FilterSet): marker__response_type = django_filters.ChoiceFilter( label="Stage", choices=ResponseType.choices() ) + assigned_section = django_filters.ChoiceFilter( + field_name="assigned_section", + label="Assigned Section", + lookup_expr="icontains", + choices=Section.objects.values_list("title", "title"), + ) # have to specify it like this otherwise bootstrap doesn't recognise it as a bound field username = django_filters.CharFilter(field_name="username", lookup_expr="icontains") diff --git a/crowdsourcer/templates/crowdsourcer/volunteers/list.html b/crowdsourcer/templates/crowdsourcer/volunteers/list.html index e6586f3..464396c 100644 --- a/crowdsourcer/templates/crowdsourcer/volunteers/list.html +++ b/crowdsourcer/templates/crowdsourcer/volunteers/list.html @@ -32,6 +32,11 @@