diff --git a/cfp/urls.py b/cfp/urls.py index 49cade1..61645c9 100644 --- a/cfp/urls.py +++ b/cfp/urls.py @@ -8,7 +8,6 @@ urlpatterns = [ url(r'^cfp/$', views.proposal_home, name='proposal-home'), url(r'^cfp/token/$', views.proposal_mail_token, name='proposal-mail-token'), url(r'^cfp/(?:(?P[\w\-]+)/)?dashboard/$', views.proposal_dashboard, name='proposal-dashboard'), - url(r'^cfp/(?P[\w\-]+)/$', views.proposal_dashboard), # backward compatibility url(r'^cfp/(?:(?P[\w\-]+)/)?profile/$', views.proposal_speaker_edit, name='proposal-profile-edit'), url(r'^cfp/(?:(?P[\w\-]+)/)?talk/add/$', views.proposal_talk_edit, name='proposal-talk-add'), url(r'^cfp/(?:(?P[\w\-]+)/)?talk/(?P[0-9]+)/$', views.proposal_talk_details, name='proposal-talk-details'), @@ -20,13 +19,6 @@ urlpatterns = [ url(r'^cfp/(?:(?P[\w\-]+)/)?talk/(?P[0-9]+)/speaker/(?P[0-9]+)/remove/$', views.proposal_speaker_remove, name='proposal-speaker-remove'), url(r'^cfp/(?:(?P[\w\-]+)/)?talk/(?P[0-9]+)/confirm/$', views.proposal_talk_acknowledgment, {'confirm': True}, name='proposal-talk-confirm'), url(r'^cfp/(?:(?P[\w\-]+)/)?talk/(?P[0-9]+)/desist/$', views.proposal_talk_acknowledgment, {'confirm': False}, name='proposal-talk-desist'), -# Backward compatibility - url(r'^cfp/(?P[\w\-]+)/speaker/add/$', views.talk_proposal_speaker_edit, name='talk-proposal-speaker-add'), - url(r'^cfp/(?P[\w\-]+)/speaker/(?P[\w\-]+)/$', views.talk_proposal_speaker_edit, name='talk-proposal-speaker-edit'), - url(r'^cfp/(?P[\w\-]+)/(?P[\w\-]+)/$', views.talk_proposal, name='talk-proposal-edit'), - url(r'^cfp/(?P[\w\-]+)/(?P[\w\-]+)/confirm/$', views.talk_acknowledgment, {'confirm': True}, name='talk-confirm'), - url(r'^cfp/(?P[\w\-]+)/(?P[\w\-]+)/desist/$', views.talk_acknowledgment, {'confirm': False}, name='talk-desist'), -# End backward compatibility url(r'^volunteer/enrole/$', views.volunteer_enrole, name='volunteer-enrole'), url(r'^volunteer/token/$', views.volunteer_mail_token, name='volunteer-mail-token'), url(r'^volunteer/(?:(?P[\w\-]+)/)?$', views.volunteer_dashboard, name='volunteer-dashboard'), diff --git a/cfp/views.py b/cfp/views.py index 0a9b5b3..01d3cd7 100644 --- a/cfp/views.py +++ b/cfp/views.py @@ -487,38 +487,9 @@ def proposal_speaker_remove(request, speaker, talk_id, co_speaker_id): return redirect(reverse('proposal-talk-details', kwargs=dict(speaker_token=speaker.token, talk_id=talk_id))) -# BACKWARD COMPATIBILITY -def talk_proposal(request, talk_id=None, participant_id=None): - if talk_id and participant_id: - talk = get_object_or_404(Talk, token=talk_id, site=request.conference.site) - speaker = get_object_or_404(Participant, token=participant_id, site=request.conference.site) - return redirect(reverse('proposal-talk-edit', kwargs=dict(speaker_token=speaker.token, talk_id=talk.pk))) - else: - return render(reverse('proposal-home')) - - -# BACKWARD COMPATIBILITY -def talk_proposal_speaker_edit(request, talk_id, participant_id=None): +@staff_required +def talk_acknowledgment(request, talk_id, confirm): talk = get_object_or_404(Talk, token=talk_id, site=request.conference.site) - if participant_id: - speaker = get_object_or_404(Participant, token=participant_id, site=request.conference.site) - return redirect(reverse('proposal-profile-edit', kwargs=dict(speaker_token=speaker.token))) - else: - speaker = talk.speakers.first() # no other choice hereā€¦ - return redirect(reverse('proposal-speaker-add', kwargs=dict(speaker_token=speaker.token, talk_id=talk.pk))) - - -# TODO: add @staff_required decorator when dropping old links support -def talk_acknowledgment(request, talk_id, confirm, participant_id=None): - talk = get_object_or_404(Talk, token=talk_id, site=request.conference.site) - if participant_id: - speaker = get_object_or_404(Participant, token=participant_id, site=request.conference.site) - if confirm: - return redirect(reverse('proposal-talk-confirm', kwargs=dict(speaker_token=speaker.token, talk_id=talk.pk))) - else: - return redirect(reverse('proposal-talk-desist', kwargs=dict(speaker_token=speaker.token, talk_id=talk.pk))) - elif not is_staff(request, request.user): - raise PermissionDenied if not talk.accepted or talk.confirmed == confirm: raise PermissionDenied # TODO: handle multiple speakers case