staff can delete speakers

This commit is contained in:
Guilhem Saurel 2017-11-19 23:35:29 +01:00
parent e4e4cd35ef
commit a2b3e50e9b
3 changed files with 21 additions and 1 deletions

View File

@ -68,7 +68,11 @@
{% for participant in talk.speakers.all %}
{% if forloop.first %}<ul>{% endif %}
<li><a href="{% url 'participant-details' participant.token %}">{{ participant }}</a>{% if participant.vip %} <span class="badge">VIP</span>{% endif %}</li>
<li>
<a href="{% url 'participant-details' participant.token %}">{{ participant }}</a>
{% if participant.vip %} <span class="badge">VIP</span>{% endif %}
<a href="{% url 'talk-speaker-remove' participant_id=participant.pk talk_id=talk.pk %}" class="btn btn-xs btn-danger"><span class=" glyphicon glyphicon-remove"></span>&nbsp;{% trans "remove" %}</a>
</li>
{% if forloop.last %}</ul>{% endif %}
{% empty %}
<i>{% trans "No speakers." %}</i>

View File

@ -43,6 +43,8 @@ urlpatterns = [
url(r'^staff/talks/(?P<talk_id>[\w\-]+)/confirm/$', views.talk_acknowledgment, {'confirm': True}, name='talk-confirm-by-staff'),
url(r'^staff/talks/(?P<talk_id>[\w\-]+)/desist/$', views.talk_acknowledgment, {'confirm': False}, name='talk-desist-by-staff'),
url(r'^staff/talks/(?P<talk_id>[\w\-]+)/edit/$', views.TalkUpdate.as_view(), name='talk-edit'),
# url(r'^staff/talks/(?P<talk_id>[\w\-]+)/speaker/add/$', views.talk_speaker_add, name='talk-speaker-add'), TODO WIP
url(r'^staff/talks/(?P<talk_id>[\w\-]+)/speaker/del/(?P<participant_id>[\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<participant_id>[\w\-]+)/$', views.participant_details, name='participant-details'),

View File

@ -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) \