diff --git a/proposals/forms.py b/proposals/forms.py index 9f35612..452bad8 100644 --- a/proposals/forms.py +++ b/proposals/forms.py @@ -75,6 +75,11 @@ class TalkFilterForm(forms.Form): class SpeakerFilterForm(forms.Form): + status = forms.MultipleChoiceField( + required=False, + widget=forms.CheckboxSelectMultiple, + choices=STATUS_CHOICES, + ) topic = forms.MultipleChoiceField( required=False, widget=forms.CheckboxSelectMultiple, diff --git a/proposals/templates/proposals/speaker_list.html b/proposals/templates/proposals/speaker_list.html index fdc8672..4d6f4d0 100644 --- a/proposals/templates/proposals/speaker_list.html +++ b/proposals/templates/proposals/speaker_list.html @@ -18,10 +18,11 @@
{% bootstrap_field filter_form.transport layout="horizontal" %} + {% bootstrap_field filter_form.hosting layout="horizontal" %}
- {% bootstrap_field filter_form.hosting layout="horizontal" %} {% bootstrap_field filter_form.sound layout="horizontal" %} + {% bootstrap_field filter_form.status layout="horizontal" %}
{% bootstrap_field filter_form.topic layout="horizontal" %} diff --git a/proposals/views.py b/proposals/views.py index e9d1d21..243075a 100644 --- a/proposals/views.py +++ b/proposals/views.py @@ -280,10 +280,13 @@ def speaker_list(request): # Filtering if filter_form.is_valid(): data = filter_form.cleaned_data + if len(data['status']): + show_filters = True + talks = talks.filter(reduce(lambda x, y: x | y, [Q(accepted=dict(STATUS_VALUES)[status]) for status in data['status']])) if len(data['topic']): show_filters = True talks = talks.filter(reduce(lambda x, y: x | y, [Q(topics__slug=topic) for topic in data['topic']])) - speakers = Participation.objects.filter(user__talk__in=talks).all().distinct() + speakers = Participation.objects.filter(site=site,user__talk__in=talks).order_by('pk').distinct() if filter_form.is_valid(): data = filter_form.cleaned_data if len(data['transport']):