forked from AFPy/PonyConf
admin: manage activities
This commit is contained in:
parent
4b7a881e16
commit
19b4e6629b
|
@ -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')
|
||||
|
|
|
@ -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
|
||||
|
|
33
cfp/templates/cfp/admin/activity_form.html
Normal file
33
cfp/templates/cfp/admin/activity_form.html
Normal file
|
@ -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 %}
|
||||
|
||||
<h1>
|
||||
{% if tag %}
|
||||
{% trans "Edit activity" %}
|
||||
{% else %}
|
||||
{% trans "New activity" %}
|
||||
{% endif %}
|
||||
</h1>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
{% include "_form.html" %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block js_end %}
|
||||
{{ block.super }}
|
||||
{{ form.media.js }}
|
||||
{% endblock %}
|
26
cfp/templates/cfp/admin/activity_list.html
Normal file
26
cfp/templates/cfp/admin/activity_list.html
Normal file
|
@ -0,0 +1,26 @@
|
|||
{% extends 'cfp/admin/base.html' %}
|
||||
|
||||
{% load bootstrap3 cfp_tags i18n %}
|
||||
|
||||
{% block activitiestab %} class="active"{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>{% trans "Activities" %}</h1>
|
||||
|
||||
<p><a href="{% url 'activity-add' %}" class="btn btn-success">{% trans "Add an activity" %}</a><p>
|
||||
|
||||
<ul class="list-group">
|
||||
{% for activity in activity_list %}
|
||||
<div class="list-group-item">
|
||||
<a href="{{ activity.get_filter_url }}" class="btn btn-primary">{{ activity.name }}</a>
|
||||
<a href="{% url 'activity-edit' activity.slug %}" class="btn btn-success pull-right">{% bootstrap_icon "pencil" %} {% trans "Edit" %}</a>
|
||||
</div>
|
||||
{% empty %}
|
||||
<li class="list-group-item">
|
||||
<i>{% trans "No activites." %}</li>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
{% endblock %}
|
|
@ -7,9 +7,10 @@
|
|||
{{ block.super }}
|
||||
<div class="container">
|
||||
<ul class="nav nav-pills nav-justified subnav">
|
||||
<li{% block conferencetab %}{% endblock %}><a href="{% url 'conference' %}"><span class="glyphicon glyphicon-asterisk"></span> {% trans "Conference" %}</a></li>
|
||||
<li{% block categoriestab %}{% endblock %}><a href="{% url 'category-list' %}"><span class="glyphicon glyphicon-asterisk"></span> {% trans "Categories" %}</a></li>
|
||||
<li{% block tagstab %}{% endblock %}><a href="{% url 'tag-list' %}"><span class="glyphicon glyphicon-asterisk"></span> {% trans "Tags" %}</a></li>
|
||||
<li{% block conferencetab %}{% endblock %}><a href="{% url 'conference' %}"><span class="glyphicon glyphicon-cog"></span> {% trans "Conference" %}</a></li>
|
||||
<li{% block categoriestab %}{% endblock %}><a href="{% url 'category-list' %}"><span class="glyphicon glyphicon-inbox"></span> {% trans "Categories" %}</a></li>
|
||||
<li{% block tagstab %}{% endblock %}><a href="{% url 'tag-list' %}"><span class="glyphicon glyphicon-tags"></span> {% trans "Tags" %}</a></li>
|
||||
<li{% block activitiestab %}{% endblock %}><a href="{% url 'activity-list' %}"><span class="glyphicon glyphicon-screenshot"></span> {% trans "Activities" %}</a></li>
|
||||
{% if request.user.is_staff %}
|
||||
<li><a href="{% url 'admin:index' %}"><span class="glyphicon glyphicon-dashboard"></span> Django-Admin</a></li>
|
||||
{% endif %}
|
||||
|
|
|
@ -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<slug>[-\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<slug>[-\w]+)/edit/$', views.ActivityUpdate.as_view(), name='activity-edit'),
|
||||
url(r'^schedule/((?P<program_format>[\w]+)/)?$', views.public_schedule, name='public-schedule'),
|
||||
#url(r'^markdown/$', views.markdown_preview, name='markdown'),
|
||||
]
|
||||
|
|
31
cfp/views.py
31
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)
|
||||
|
|
Binary file not shown.
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue
Block a user