diff --git a/pyconbalkan/core/static/css/components/datepicker.css b/pyconbalkan/core/static/css/components/datepicker.css
new file mode 100644
index 00000000..330eb2a9
--- /dev/null
+++ b/pyconbalkan/core/static/css/components/datepicker.css
@@ -0,0 +1,10 @@
+.ui-datepicker {
+ background-color: #32383A;
+ border: 1px solid #66AFE9;
+ border-radius: 4px;
+ box-shadow: 0 0 8px rgba(102,175,233,.6);
+ display: none;
+ margin-top: 4px;
+ padding: 10px;
+ width: 240px;
+}
\ No newline at end of file
diff --git a/pyconbalkan/core/static/js/volunteer.js b/pyconbalkan/core/static/js/volunteer.js
new file mode 100644
index 00000000..e5b29d93
--- /dev/null
+++ b/pyconbalkan/core/static/js/volunteer.js
@@ -0,0 +1,5 @@
+$( ".datepicker" ).datepicker({
+ changeMonth: true,
+ changeYear: true,
+ yearRange: "1900:2018"
+});
\ No newline at end of file
diff --git a/pyconbalkan/core/templates/base.html b/pyconbalkan/core/templates/base.html
index 6bfc6af6..362f39fd 100644
--- a/pyconbalkan/core/templates/base.html
+++ b/pyconbalkan/core/templates/base.html
@@ -24,6 +24,7 @@
+
diff --git a/pyconbalkan/core/templates/includes/event_sidebar.html b/pyconbalkan/core/templates/includes/event_sidebar.html
index 5ba0b566..df626ca4 100644
--- a/pyconbalkan/core/templates/includes/event_sidebar.html
+++ b/pyconbalkan/core/templates/includes/event_sidebar.html
@@ -21,6 +21,7 @@
diff --git a/pyconbalkan/organizers/forms.py b/pyconbalkan/organizers/forms.py
new file mode 100644
index 00000000..d27ca988
--- /dev/null
+++ b/pyconbalkan/organizers/forms.py
@@ -0,0 +1,22 @@
+from django import forms
+
+from pyconbalkan.organizers.models import Volunteer
+
+
+class VolunteerCreateForm(forms.ModelForm):
+
+ def __init__(self, **kwargs):
+ super().__init__(**kwargs)
+
+ # delete labels, add form-control class to all fields
+ for f in self.fields.values():
+ old_classes = f.widget.attrs['class'] if 'class' in f.widget.attrs else ''
+ f.widget.attrs.update({'placeholder': f.label, 'class': f'{old_classes} form-control'})
+ f.label = ''
+
+ class Meta:
+ model = Volunteer
+ exclude = ('active', 'user', 'weight', 'type', 'slug', 'description', )
+ widgets = {
+ 'date_of_birth': forms.DateInput(attrs={'class': 'datepicker'}),
+ }
diff --git a/pyconbalkan/organizers/templates/volunteers_create.html b/pyconbalkan/organizers/templates/volunteers_create.html
new file mode 100644
index 00000000..2837f5c6
--- /dev/null
+++ b/pyconbalkan/organizers/templates/volunteers_create.html
@@ -0,0 +1,32 @@
+{% extends 'base.html' %}
+{% load static %}
+
+{% block main_content %}
+
Sign up as a Volunteer!
+
+
+ {% if success %}
+
+ {{ success }}
+
+ {% endif %}
+
+
+
+{% endblock main_content %}
+
+
+{% block scripts %}
+
+
+{% endblock %}
diff --git a/pyconbalkan/organizers/views.py b/pyconbalkan/organizers/views.py
index ee254558..03975f28 100644
--- a/pyconbalkan/organizers/views.py
+++ b/pyconbalkan/organizers/views.py
@@ -2,6 +2,7 @@
from rest_framework import viewsets
from pyconbalkan.conference.models import Conference
+from pyconbalkan.organizers.forms import VolunteerCreateForm
from pyconbalkan.organizers.models import Volunteer
from pyconbalkan.organizers.serializers import VolunteerSerializer
@@ -28,4 +29,21 @@ def organizers_listview(request):
'organizers': organizers,
'conference': conference.first() if conference else None,
}
- return render(request, 'organizers.html', context)
\ No newline at end of file
+ return render(request, 'organizers.html', context)
+
+
+def volunteer_createview(request):
+ context = {}
+
+ if request.method == 'POST':
+ form = VolunteerCreateForm(data=request.POST)
+ if form.is_valid():
+ volunteer = form.save()
+ context['success'] = f'{volunteer.full_name}, you have been successfully signed up ' \
+ f'as a volunteer! Thank you!'
+ form = VolunteerCreateForm()
+ else:
+ form = VolunteerCreateForm()
+
+ context['form'] = form
+ return render(request, 'volunteers_create.html', context)
diff --git a/pyconbalkan/urls.py b/pyconbalkan/urls.py
index f12c57ae..eddfa08b 100644
--- a/pyconbalkan/urls.py
+++ b/pyconbalkan/urls.py
@@ -10,7 +10,7 @@
from pyconbalkan.contact.views import contact_view
from pyconbalkan.news.views import *
from pyconbalkan.speaker.views import *
-from pyconbalkan.organizers.views import organizer_view, organizers_listview
+from pyconbalkan.organizers.views import organizer_view, organizers_listview, volunteer_createview
from pyconbalkan.coc.views import coc_view, response_guide
from pyconbalkan.sponsors.views import sponsor_view
from pyconbalkan.organizers.api_urls import router as organizers
@@ -44,6 +44,7 @@
path('robots.txt', TemplateView.as_view(template_name='robots.txt', content_type='text/plain')),
path('organizers/
/', organizer_view, name='organizer_detail'),
path('organizers', organizers_listview, name='organizers'),
+ path('volunteer/create/', volunteer_createview, name='volunteer_create'),
path('about', about_view, name='about'),
path('contact', contact_view, name='contact'),
path('cfp', cfp_view, name='cfp'),