diff --git a/cfp/forms.py b/cfp/forms.py
index c3eb7cd..78517ce 100644
--- a/cfp/forms.py
+++ b/cfp/forms.py
@@ -9,7 +9,8 @@ from django.utils.crypto import get_random_string
from django_select2.forms import ModelSelect2MultipleWidget
-from .models import Participant, Talk, TalkCategory, Track, Tag, Conference, Room, Volunteer
+from .models import Participant, Talk, TalkCategory, Track, Tag, \
+ Conference, Room, Volunteer, Activity
ACCEPTATION_CHOICES = [
@@ -35,6 +36,20 @@ CONFIRMATION_VALUES = [
]
+class VolunteerFilterForm(forms.Form):
+ activity = forms.MultipleChoiceField(
+ required=False,
+ widget=forms.CheckboxSelectMultiple,
+ choices=[],
+ )
+
+ def __init__(self, *args, **kwargs):
+ site = kwargs.pop('site')
+ super().__init__(*args, **kwargs)
+ activities = Activity.objects.filter(site=site)
+ self.fields['activity'].choices = activities.values_list('slug', 'name')
+
+
class TalkForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
categories = kwargs.pop('categories')
diff --git a/cfp/models.py b/cfp/models.py
index f7c2a4b..18f433f 100644
--- a/cfp/models.py
+++ b/cfp/models.py
@@ -43,12 +43,6 @@ class Conference(models.Model):
custom_css = models.TextField(blank=True)
external_css_link = models.URLField(blank=True)
- #subscriptions_open = models.BooleanField(default=False) # workshop subscription
-
- #def cfp_is_open(self):
- # events = Event.objects.filter(site=self.site)
- # return any(map(lambda x: x.is_open(), events))
-
def volunteers_enrollment_is_open(self):
now = timezone.now()
opening = self.volunteers_opening_date
diff --git a/cfp/templates/cfp/staff/base.html b/cfp/templates/cfp/staff/base.html
index d04c05d..daab9c0 100644
--- a/cfp/templates/cfp/staff/base.html
+++ b/cfp/templates/cfp/staff/base.html
@@ -12,6 +12,7 @@
{% endcomment %}
{% trans "Talks" %}
{% trans "Speakers" %}
+ {% trans "Volunteers" %}
{% trans "Tracks" %}
{% trans "Rooms" %}
{% trans "Schedule" %}
diff --git a/cfp/templates/cfp/staff/volunteer_list.html b/cfp/templates/cfp/staff/volunteer_list.html
new file mode 100644
index 0000000..406771c
--- /dev/null
+++ b/cfp/templates/cfp/staff/volunteer_list.html
@@ -0,0 +1,73 @@
+{% extends 'cfp/staff/base.html' %}
+
+{% load bootstrap3 i18n %}
+
+{% block volunteerstab %} class="active"{% endblock %}
+
+{% block content %}
+
+{% trans "Volunteers" %}
+
+{% trans "Show filtering options…" %}
+
+
+
+
+
+
+ {% trans "Total:" %} {{ volunteer_list|length }} {% trans "volunteer" %}{{ volunteer_list|length|pluralize }}
+
+
+
+ {% trans "Name" %} |
+ {% trans "Email" %} |
+ {% trans "Activities" %} |
+
+
+
+
+ {% trans "Contact:" %} {% trans "link" %} |
+
+
+ {% for volunteer in volunteer_list %}
+ {% if forloop.first %}
+
+ {% endif %}
+
+ {{ volunteer.name }} |
+ {{ volunteer.email }} |
+
+ {% for activity in volunteer.activities.all %}
+ {{ activity }}
+ {% endfor %}
+ |
+
+ {% if forloop.last %}
+
+ {% endif %}
+ {% endfor %}
+
+
+{% endblock %}
+
+{% block js_end %}
+
+{% endblock %}
diff --git a/cfp/urls.py b/cfp/urls.py
index c1799aa..a0d3518 100644
--- a/cfp/urls.py
+++ b/cfp/urls.py
@@ -33,6 +33,7 @@ urlpatterns = [
url(r'^staff/rooms/add/$', views.RoomCreate.as_view(), name='room-add'),
url(r'^staff/rooms/(?P[-\w]+)/$', views.RoomDetail.as_view(), name='room-details'),
url(r'^staff/rooms/(?P[-\w]+)/edit/$', views.RoomUpdate.as_view(), name='room-edit'),
+ url(r'^staff/volunteers/$', views.volunteer_list, name='volunteer-list'),
url(r'^staff/add-user/$', views.create_user, name='create-user'),
url(r'^staff/schedule/((?P[\w]+)/)?$', views.staff_schedule, name='staff-schedule'),
url(r'^staff/select2/$', views.Select2View.as_view(), name='django_select2-json'),
diff --git a/cfp/views.py b/cfp/views.py
index eb95f62..fcc6095 100644
--- a/cfp/views.py
+++ b/cfp/views.py
@@ -25,7 +25,8 @@ from .utils import is_staff
from .models import Participant, Talk, TalkCategory, Vote, Track, Tag, Room, Volunteer, Activity
from .forms import TalkForm, TalkStaffForm, TalkFilterForm, TalkActionForm, \
ParticipantForm, ParticipantStaffForm, ParticipantFilterForm, \
- ConferenceForm, CreateUserForm, TrackForm, RoomForm, VolunteerForm, \
+ ConferenceForm, CreateUserForm, TrackForm, RoomForm, \
+ VolunteerForm, VolunteerFilterForm, \
ACCEPTATION_VALUES, CONFIRMATION_VALUES
@@ -76,8 +77,28 @@ def volunteer_activity(request, volunteer_id, activity, join):
return redirect(reverse('volunteer', kwargs=dict(volunteer_id=volunteer.token)))
-def talk_proposal(request, talk_id=None, participant_id=None):
+@staff_required
+def volunteer_list(request):
+ site = request.conference.site
+ show_filters = False
+ filter_form = VolunteerFilterForm(request.GET or None, site=site)
+ # Filtering
+ volunteers = Volunteer.objects.filter(site=site, activities__isnull=False).order_by('pk').distinct()
+ if filter_form.is_valid():
+ data = filter_form.cleaned_data
+ if len(data['activity']):
+ show_filters = True
+ volunteers = volunteers.filter(activities__slug__in=data['activity'])
+ contact_link = 'mailto:' + ','.join([volunteer.email for volunteer in volunteers.all()])
+ return render(request, 'cfp/staff/volunteer_list.html', {
+ 'volunteer_list': volunteers,
+ 'filter_form': filter_form,
+ 'show_filters': show_filters,
+ 'contact_link': contact_link,
+ })
+
+def talk_proposal(request, talk_id=None, participant_id=None):
conference = request.conference
site = conference.site
if is_staff(request, request.user):
diff --git a/ponyconf/templates/base.html b/ponyconf/templates/base.html
index cb5ca09..49150ff 100644
--- a/ponyconf/templates/base.html
+++ b/ponyconf/templates/base.html
@@ -17,16 +17,18 @@