From ecab4cc23da9146f5055ac7ade7a80f67338b9fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lie=20Bouttier?= Date: Sun, 26 Nov 2017 20:30:19 +0100 Subject: [PATCH] fix tests and regressions --- cfp/signals.py | 4 ++-- cfp/tests.py | 4 ++-- cfp/urls.py | 4 ++-- cfp/views.py | 4 ++++ 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cfp/signals.py b/cfp/signals.py index 77e1426..6fbc901 100644 --- a/cfp/signals.py +++ b/cfp/signals.py @@ -80,7 +80,7 @@ def send_message_notifications(sender, instance, **kwargs): participant_subject = _('[%(prefix)s] Message from the staff') % {'prefix': conf.name} staff_subject = _('[%(prefix)s] Conversation with %(dest)s') % {'prefix': conf.name, 'dest': participant.name} proto = 'https' if conf.secure_domain else 'http' - footer = '\n\n--\n%s://' % proto + conf.site.domain + reverse('participant-details', args=[participant.token]) + footer = '\n\n--\n%s://' % proto + conf.site.domain + reverse('participant-details', args=[participant.pk]) if message.from_email == conf.contact_email: # this is a talk notification message # send it only to the participant message.send_notification(subject=subject_prefix+participant_subject, sender=sender, dests=participant_dests, @@ -96,7 +96,7 @@ def send_message_notifications(sender, instance, **kwargs): conf = thread.talk.site.conference subject = _('[%(prefix)s] Talk: %(talk)s') % {'prefix': conf.name, 'talk': thread.talk.title} proto = 'https' if conf.secure_domain else 'http' - footer = '\n\n--\n%s://' % proto + conf.site.domain + reverse('talk-details', args=[thread.talk.token]) + footer = '\n\n--\n%s://' % proto + conf.site.domain + reverse('talk-details', args=[thread.talk.pk]) message.send_notification(subject=subject_prefix+subject, sender=sender, dests=staff_dests, reply_to=reply_to, message_id=message_id, reference=reference, footer=footer) diff --git a/cfp/tests.py b/cfp/tests.py index cf0bbe2..295696c 100644 --- a/cfp/tests.py +++ b/cfp/tests.py @@ -229,7 +229,7 @@ class ProposalTest(TestCase): def test_proposal_talk_edit(self): speaker = Participant.objects.get(name='Speaker 1') talk = Talk.objects.get(title='Talk 1') - url = reverse('proposal-talk-edit', kwargs=dict(speaker_token=speaker.token, talk_id=talk.pk)) + url = reverse('proposal-talk-edit', kwargs={'speaker_token': speaker.token, 'talk_id': talk.pk}) response = self.client.get(url) self.assertEquals(response.status_code, 200) self.assertRedirects(self.client.post(url, { @@ -522,7 +522,7 @@ class StaffTest(TestCase): def test_conference(self): conf = Conference.objects.get(name='PonyConf') - url = reverse('conference') + url = reverse('conference-edit') self.assertRedirects(self.client.get(url), reverse('login') + '?next=' + url) self.client.login(username='admin', password='admin') response = self.client.get(url) diff --git a/cfp/urls.py b/cfp/urls.py index 29d7358..b8e93e4 100644 --- a/cfp/urls.py +++ b/cfp/urls.py @@ -34,14 +34,14 @@ urlpatterns = [ url(r'^staff/talks/(?P[0-9]+)/decline/$', views.talk_decide, {'accept': False}, name='talk-decline'), url(r'^staff/talks/(?P[0-9]+)/confirm/$', views.talk_acknowledgment, {'confirm': True}, name='talk-confirm-by-staff'), url(r'^staff/talks/(?P[0-9]+)/desist/$', views.talk_acknowledgment, {'confirm': False}, name='talk-desist-by-staff'), - url(r'^staff/talks/(?P[0-9]+)/edit/$', views.TalkUpdate.as_view(), name='talk-edit'), + url(r'^staff/talks/(?P[0-9]+)/edit/$', views.TalkUpdate.as_view(), name='talk-edit'), # url(r'^staff/talks/(?P[0-9]+)/speaker/add/$', views.talk_speaker_add, name='talk-speaker-add'), TODO WIP url(r'^staff/talks/(?P[0-9]+)/speaker/remove/(?P[0-9]+)/$', views.talk_speaker_remove, 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[0-9]+)/$', views.participant_details, name='participant-details'), url(r'^staff/speakers/(?P[0-9]+)/add-talk/$', views.participant_add_talk, name='participant-add-talk'), - url(r'^staff/speakers/(?P[0-9]+)/edit/$', views.ParticipantUpdate.as_view(), name='participant-edit'), + url(r'^staff/speakers/(?P[0-9]+)/edit/$', views.ParticipantUpdate.as_view(), name='participant-edit'), url(r'^staff/tracks/$', views.TrackList.as_view(), name='track-list'), url(r'^staff/tracks/add/$', views.TrackCreate.as_view(), name='track-add'), url(r'^staff/tracks/(?P[-\w]+)/edit/$', views.TrackUpdate.as_view(), name='track-edit'), diff --git a/cfp/views.py b/cfp/views.py index 40cb861..b3ded3a 100644 --- a/cfp/views.py +++ b/cfp/views.py @@ -803,6 +803,8 @@ class ParticipantCreate(StaffRequiredMixin, OnSiteFormMixin, CreateView): class ParticipantUpdate(StaffRequiredMixin, OnSiteFormMixin, UpdateView): model = Participant template_name = 'cfp/staff/participant_form.html' + slug_field = 'pk' + slug_url_kwarg = 'participant_id' def get_form_class(self): return modelform_factory( @@ -885,6 +887,8 @@ class TalkUpdate(StaffRequiredMixin, OnSiteMixin, OnSiteFormMixin, UpdateView): model = Talk form_class = TalkStaffForm template_name = 'cfp/staff/talk_form.html' + slug_field = 'pk' + slug_url_kwarg = 'talk_id' class TrackMixin(OnSiteMixin):