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" %}

+ +

+ +{% 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 }}