From 5a97705cc978ada27ba05a56ee9c5eac5fd7fb4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lie=20Bouttier?= Date: Tue, 11 Oct 2016 22:37:40 +0200 Subject: [PATCH] filter talk by room and schedule status --- proposals/forms.py | 2 ++ proposals/templates/proposals/talk_list.html | 4 +++- proposals/views.py | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/proposals/forms.py b/proposals/forms.py index a186603..852b804 100644 --- a/proposals/forms.py +++ b/proposals/forms.py @@ -60,6 +60,8 @@ class TalkFilterForm(forms.Form): choices=[], ) vote = forms.NullBooleanField(help_text=_('Filter talks you already / not yet voted for')) + room = forms.NullBooleanField(help_text=_('Filter talks already / not yet affected to a room')) + scheduled = forms.NullBooleanField(help_text=_('Filter talks already / not yet scheduled')) def __init__(self, *args, **kwargs): site = kwargs.pop('site') diff --git a/proposals/templates/proposals/talk_list.html b/proposals/templates/proposals/talk_list.html index 3741c97..a8045f6 100644 --- a/proposals/templates/proposals/talk_list.html +++ b/proposals/templates/proposals/talk_list.html @@ -18,8 +18,10 @@
{% bootstrap_field filter_form.status layout="horizontal" %} - {% bootstrap_field filter_form.vote layout="horizontal" %} {% bootstrap_field filter_form.kind layout="horizontal" %} + {% bootstrap_field filter_form.vote layout="horizontal" %} + {% bootstrap_field filter_form.room layout="horizontal" %} + {% bootstrap_field filter_form.scheduled layout="horizontal" %}
{% bootstrap_field filter_form.topic layout="horizontal" %} diff --git a/proposals/views.py b/proposals/views.py index 6e8e188..4b18009 100644 --- a/proposals/views.py +++ b/proposals/views.py @@ -96,6 +96,10 @@ def talk_list(request): talks = talks.filter(vote__user=request.user) else: talks = talks.exclude(vote__user=request.user) + if data['room'] != None: + talks = talks.filter(room__isnull=not data['room']) + if data['scheduled'] != None: + talks = talks.filter(start_date__isnull=not data['scheduled']) # Sorting if request.GET.get('order') == 'desc': reverse = True