diff --git a/proposals/forms.py b/proposals/forms.py index 852b804..23ef5b1 100644 --- a/proposals/forms.py +++ b/proposals/forms.py @@ -7,6 +7,7 @@ from django_select2.forms import Select2TagWidget from accounts.models import User, Participation, Transport from proposals.models import Conference, Event, Talk, Topic, Track +from planning.models import Room STATUS_CHOICES = [ ('pending', 'Pending decision'), @@ -74,6 +75,23 @@ class TalkFilterForm(forms.Form): self.fields['track'].choices = [('none', 'Not assigned')] + list(tracks.values_list('slug', 'name')) +class TalkActionForm(forms.Form): + talks = forms.MultipleChoiceField(choices=[]) + decision = forms.NullBooleanField(label=_('Accept talk?')) + track = forms.ChoiceField(required=False, choices=[], label=_('Assign to a track')) + room = forms.ChoiceField(required=False, choices=[], label=_('Put in a room')) + + def __init__(self, *args, **kwargs): + site = kwargs.pop('site') + talks = kwargs.pop('talks') + super().__init__(*args, **kwargs) + self.fields['talks'].choices = [(talk.slug, None) for talk in talks.all()] + tracks = Track.objects.filter(site=site) + self.fields['track'].choices = [(None, "---------")] + list(tracks.values_list('slug', 'name')) + rooms = Room.objects.filter(site=site) + self.fields['room'].choices = [(None, "---------")] + list(rooms.values_list('slug', 'name')) + + def get_options(option): try: options = list(option.objects.values_list('pk', 'name')) diff --git a/proposals/templates/proposals/talk_list.html b/proposals/templates/proposals/talk_list.html index a8045f6..729e2c1 100644 --- a/proposals/templates/proposals/talk_list.html +++ b/proposals/templates/proposals/talk_list.html @@ -1,6 +1,6 @@ {% extends 'base.html' %} -{% load bootstrap3 i18n %} +{% load bootstrap3 i18n accounts_tags %} {% block talktab %} class="active"{% endblock %} @@ -35,9 +35,12 @@ +
+ + @@ -49,9 +52,13 @@ {% for talk in talk_list %} {% if forloop.first %} + + + {% endif %} - - + + +
{% trans "Title" %} {% trans "Intervention kind" %} {% trans "Speakers" %}
{% trans "Total:" %} {{ talk_list|length }} {% trans "talk" %}{{ talk_list|length|pluralize }}
{{ talk.title }}
{{ talk.title }} {{ talk.event }} {% for speaker in talk.speakers.all %} @@ -87,15 +94,30 @@
+{% if action_form %} +
+
+

For selected talks:

+ {% csrf_token %} + {% bootstrap_field action_form.decision %} + {% if request|orga %} + {% bootstrap_field action_form.track %} + {% bootstrap_field action_form.room %} + {% endif %} + {% buttons %} + + {% endbuttons %} +
+
+{% endif %} + +
+ {% endblock %} {% block js_end %}