From a2b3e50e9b4fb9a71ec6be3f894718f6e7986a9f Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Sun, 19 Nov 2017 23:35:29 +0100 Subject: [PATCH] staff can delete speakers --- cfp/templates/cfp/staff/talk_details.html | 6 +++++- cfp/urls.py | 2 ++ cfp/views.py | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/cfp/templates/cfp/staff/talk_details.html b/cfp/templates/cfp/staff/talk_details.html index 7c06045..9ef9459 100644 --- a/cfp/templates/cfp/staff/talk_details.html +++ b/cfp/templates/cfp/staff/talk_details.html @@ -68,7 +68,11 @@ {% for participant in talk.speakers.all %} {% if forloop.first %}{% endif %} {% empty %} {% trans "No speakers." %} diff --git a/cfp/urls.py b/cfp/urls.py index 35108ea..0c696ac 100644 --- a/cfp/urls.py +++ b/cfp/urls.py @@ -43,6 +43,8 @@ urlpatterns = [ url(r'^staff/talks/(?P[\w\-]+)/confirm/$', views.talk_acknowledgment, {'confirm': True}, name='talk-confirm-by-staff'), url(r'^staff/talks/(?P[\w\-]+)/desist/$', views.talk_acknowledgment, {'confirm': False}, name='talk-desist-by-staff'), url(r'^staff/talks/(?P[\w\-]+)/edit/$', views.TalkUpdate.as_view(), name='talk-edit'), + # url(r'^staff/talks/(?P[\w\-]+)/speaker/add/$', views.talk_speaker_add, name='talk-speaker-add'), TODO WIP + url(r'^staff/talks/(?P[\w\-]+)/speaker/del/(?P[\w\-]+)/$', views.talk_speaker_del, name='talk-speaker-remove'), url(r'^staff/speakers/$', views.participant_list, name='participant-list'), url(r'^staff/speakers/add/$', views.ParticipantCreate.as_view(), name='participant-add'), url(r'^staff/speakers/(?P[\w\-]+)/$', views.participant_details, name='participant-details'), diff --git a/cfp/views.py b/cfp/views.py index 431f3ca..10f381b 100644 --- a/cfp/views.py +++ b/cfp/views.py @@ -735,6 +735,20 @@ def talk_decide(request, talk_id, accept): }) +# @staff_required TODO WIP +# def talk_speaker_add(request, talk_id, participant_id=None): + # talk = get_object_or_404(Talk, token=talk_id, site=request.conference.site) + + +@staff_required +def talk_speaker_del(request, talk_id, participant_id): + talk = get_object_or_404(Talk, pk=talk_id, site=request.conference.site) + participant = get_object_or_404(Participant, pk=participant_id, site=request.conference.site) + talk.speakers.remove(participant) + messages.success(request, _('Speaker removed from this talk')) + return redirect(talk.get_absolute_url()) + + @staff_required def participant_list(request): participants = Participant.objects.filter(site=request.conference.site) \