diff --git a/cfp/forms.py b/cfp/forms.py
index 8e65a5b..603207c 100644
--- a/cfp/forms.py
+++ b/cfp/forms.py
@@ -326,6 +326,12 @@ class TagForm(OnSiteNamedModelForm):
fields = ['name', 'color', 'inverted', 'public']
+class ActivityForm(OnSiteNamedModelForm):
+ class Meta:
+ model = Activity
+ fields = ['name', 'description']
+
+
class VolunteerForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
self.conference = kwargs.pop('conference')
diff --git a/cfp/models.py b/cfp/models.py
index de85041..5e217a6 100644
--- a/cfp/models.py
+++ b/cfp/models.py
@@ -470,5 +470,11 @@ class Activity(models.Model):
verbose_name = _('Activity')
verbose_name_plural = _('Activities')
+ def get_absolute_url(self):
+ return reverse('activity-list')
+
+ def get_filter_url(self):
+ return reverse('volunteer-list') + '?activity=' + self.slug
+
def __str__(self):
return self.name
diff --git a/cfp/templates/cfp/admin/activity_form.html b/cfp/templates/cfp/admin/activity_form.html
new file mode 100644
index 0000000..6feb503
--- /dev/null
+++ b/cfp/templates/cfp/admin/activity_form.html
@@ -0,0 +1,33 @@
+{% extends 'cfp/admin/base.html' %}
+
+{% load bootstrap3 i18n %}
+
+{% block activitiestab %} class="active"{% endblock %}
+
+{% block css %}
+{{ block.super }}
+{{ form.media.css }}
+{% endblock %}
+
+{% block content %}
+
+
+ {% if tag %}
+ {% trans "Edit activity" %}
+ {% else %}
+ {% trans "New activity" %}
+ {% endif %}
+
+
+
+
+{% include "_form.html" %}
+
+
+
+{% endblock %}
+
+{% block js_end %}
+{{ block.super }}
+{{ form.media.js }}
+{% endblock %}
diff --git a/cfp/templates/cfp/admin/activity_list.html b/cfp/templates/cfp/admin/activity_list.html
new file mode 100644
index 0000000..4eb8fed
--- /dev/null
+++ b/cfp/templates/cfp/admin/activity_list.html
@@ -0,0 +1,26 @@
+{% extends 'cfp/admin/base.html' %}
+
+{% load bootstrap3 cfp_tags i18n %}
+
+{% block activitiestab %} class="active"{% endblock %}
+
+{% block content %}
+
+{% trans "Activities" %}
+
+{% trans "Add an activity" %}
+
+
+ {% for activity in activity_list %}
+
+ {% empty %}
+ -
+ {% trans "No activites." %}
+
+ {% endfor %}
+
+
+{% endblock %}
diff --git a/cfp/templates/cfp/admin/base.html b/cfp/templates/cfp/admin/base.html
index f204984..fd40826 100644
--- a/cfp/templates/cfp/admin/base.html
+++ b/cfp/templates/cfp/admin/base.html
@@ -7,9 +7,10 @@
{{ block.super }}
- - {% trans "Conference" %}
- - {% trans "Categories" %}
- - {% trans "Tags" %}
+ - {% trans "Conference" %}
+ - {% trans "Categories" %}
+ - {% trans "Tags" %}
+ - {% trans "Activities" %}
{% if request.user.is_staff %}
- Django-Admin
{% endif %}
diff --git a/cfp/urls.py b/cfp/urls.py
index cb60729..1750474 100644
--- a/cfp/urls.py
+++ b/cfp/urls.py
@@ -65,6 +65,9 @@ urlpatterns = [
url(r'^staff/tags/$', views.TagList.as_view(), name='tag-list'),
url(r'^staff/tags/add/$', views.TagCreate.as_view(), name='tag-add'),
url(r'^staff/tags/(?P[-\w]+)/edit/$', views.TagUpdate.as_view(), name='tag-edit'),
+ url(r'^staff/activities/$', views.ActivityList.as_view(), name='activity-list'),
+ url(r'^staff/activities/add/$', views.ActivityCreate.as_view(), name='activity-add'),
+ url(r'^staff/activities/(?P[-\w]+)/edit/$', views.ActivityUpdate.as_view(), name='activity-edit'),
url(r'^schedule/((?P[\w]+)/)?$', views.public_schedule, name='public-schedule'),
#url(r'^markdown/$', views.markdown_preview, name='markdown'),
]
diff --git a/cfp/views.py b/cfp/views.py
index 49de4a0..7104064 100644
--- a/cfp/views.py
+++ b/cfp/views.py
@@ -29,7 +29,7 @@ from .forms import TalkForm, TalkStaffForm, TalkFilterForm, TalkActionForm, \
ParticipantForm, ParticipantFilterForm, NotifyForm, \
ConferenceForm, CreateUserForm, TrackForm, RoomForm, \
VolunteerForm, VolunteerFilterForm, MailForm, \
- TagForm, TalkCategoryForm, \
+ TagForm, TalkCategoryForm, ActivityForm, \
ACCEPTATION_VALUES, CONFIRMATION_VALUES
@@ -896,6 +896,35 @@ class TagUpdate(StaffRequiredMixin, TagFormMixin, UpdateView):
pass
+class ActivityMixin(OnSiteMixin):
+ model = Activity
+
+
+class ActivityList(StaffRequiredMixin, ActivityMixin, ListView):
+ template_name = 'cfp/admin/activity_list.html'
+
+
+class ActivityFormMixin(ActivityMixin):
+ template_name = 'cfp/admin/activity_form.html'
+ form_class = ActivityForm
+ success_url = reverse_lazy('activity-list')
+
+ def get_form_kwargs(self):
+ kwargs = super().get_form_kwargs()
+ kwargs.update({
+ 'conference': self.request.conference,
+ })
+ return kwargs
+
+
+class ActivityCreate(StaffRequiredMixin, ActivityFormMixin, CreateView):
+ pass
+
+
+class ActivityUpdate(StaffRequiredMixin, ActivityFormMixin, UpdateView):
+ pass
+
+
@staff_required
def create_user(request):
form = CreateUserForm(request.POST or None)
diff --git a/locale/fr/LC_MESSAGES/django.mo b/locale/fr/LC_MESSAGES/django.mo
index 645f52d..b10b171 100644
Binary files a/locale/fr/LC_MESSAGES/django.mo and b/locale/fr/LC_MESSAGES/django.mo differ
diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po
index 921c94c..6191abb 100644
--- a/locale/fr/LC_MESSAGES/django.po
+++ b/locale/fr/LC_MESSAGES/django.po
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2017-11-07 22:57+0000\n"
-"PO-Revision-Date: 2017-11-07 23:58+0100\n"
+"POT-Creation-Date: 2017-11-07 23:13+0000\n"
+"PO-Revision-Date: 2017-11-08 00:14+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
@@ -402,7 +402,9 @@ msgstr "Si vous avez des contraintes, vous pouvez les indiquer ici."
msgid "Volunteer"
msgstr "Bénévole"
-#: cfp/models.py:471 cfp/templates/cfp/staff/volunteer_details.html:27
+#: cfp/models.py:471 cfp/templates/cfp/admin/activity_list.html:9
+#: cfp/templates/cfp/admin/base.html:13
+#: cfp/templates/cfp/staff/volunteer_details.html:27
#: cfp/templates/cfp/staff/volunteer_list.html:32
msgid "Activities"
msgstr "Activités"
@@ -422,6 +424,30 @@ msgstr "[%(prefix)s] Conversation avec %(dest)s"
msgid "[%(prefix)s] Talk: %(talk)s"
msgstr "[%(prefix)s] Talk: %(talk)s"
+#: cfp/templates/cfp/admin/activity_form.html:16
+msgid "Edit activity"
+msgstr "Édition d’une activité"
+
+#: cfp/templates/cfp/admin/activity_form.html:18
+msgid "New activity"
+msgstr "Nouvelle activité"
+
+#: cfp/templates/cfp/admin/activity_list.html:11
+msgid "Add an activity"
+msgstr "Ajouter une activité"
+
+#: cfp/templates/cfp/admin/activity_list.html:17
+#: cfp/templates/cfp/admin/category_list.html:17
+#: cfp/templates/cfp/admin/tag_list.html:17
+#: cfp/templates/cfp/staff/participant_details.html:13
+#: cfp/templates/cfp/staff/talk_details.html:10
+msgid "Edit"
+msgstr "Éditer"
+
+#: cfp/templates/cfp/admin/activity_list.html:21
+msgid "No activites."
+msgstr "Aucune activité."
+
#: cfp/templates/cfp/admin/base.html:10
#: cfp/templates/cfp/admin/conference.html:8
msgid "Conference"
@@ -438,7 +464,7 @@ msgstr "Catégories"
msgid "Tags"
msgstr "Étiquettes"
-#: cfp/templates/cfp/admin/base.html:21 cfp/templates/cfp/staff/base.html:21
+#: cfp/templates/cfp/admin/base.html:22 cfp/templates/cfp/staff/base.html:21
msgid "Please select a category."
msgstr "Veuillez sélectionner une catégorie."
@@ -454,13 +480,6 @@ msgstr "Nouvelle catégorie"
msgid "Add a category"
msgstr "Ajouter une catégorie"
-#: cfp/templates/cfp/admin/category_list.html:17
-#: cfp/templates/cfp/admin/tag_list.html:17
-#: cfp/templates/cfp/staff/participant_details.html:13
-#: cfp/templates/cfp/staff/talk_details.html:10
-msgid "Edit"
-msgstr "Éditer"
-
#: cfp/templates/cfp/admin/category_list.html:21
msgid "No categories."
msgstr "Aucune catégorie."
@@ -1339,11 +1358,11 @@ msgstr ""
msgid "Modifications successfully saved."
msgstr "Modification enregistrée avec succès."
-#: cfp/views.py:905
+#: cfp/views.py:934
msgid "User created successfully."
msgstr "Utilisateur créé avec succès."
-#: cfp/views.py:926
+#: cfp/views.py:955
#, python-format
msgid "Format '%s' not available"
msgstr "Format '%s' non disponible"