forked from AFPy/PonyConf
filter speakers by talks status
This commit is contained in:
parent
1f635cb379
commit
b605a85903
|
@ -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,
|
||||
|
|
|
@ -18,10 +18,11 @@
|
|||
<div class="row">
|
||||
<div class="col-md-4 col-xs-6">
|
||||
{% bootstrap_field filter_form.transport layout="horizontal" %}
|
||||
{% bootstrap_field filter_form.hosting layout="horizontal" %}
|
||||
</div>
|
||||
<div class="col-md-4 col-xs-6">
|
||||
{% bootstrap_field filter_form.hosting layout="horizontal" %}
|
||||
{% bootstrap_field filter_form.sound layout="horizontal" %}
|
||||
{% bootstrap_field filter_form.status layout="horizontal" %}
|
||||
</div>
|
||||
<div class="col-md-4 col-xs-6">
|
||||
{% bootstrap_field filter_form.topic layout="horizontal" %}
|
||||
|
|
|
@ -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']):
|
||||
|
|
Loading…
Reference in New Issue
Block a user