fix tests and regressions

This commit is contained in:
Élie Bouttier 2017-11-26 20:30:19 +01:00
parent dc10f4132b
commit ecab4cc23d
4 changed files with 10 additions and 6 deletions

View File

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

View File

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

View File

@ -34,14 +34,14 @@ urlpatterns = [
url(r'^staff/talks/(?P<talk_id>[0-9]+)/decline/$', views.talk_decide, {'accept': False}, name='talk-decline'),
url(r'^staff/talks/(?P<talk_id>[0-9]+)/confirm/$', views.talk_acknowledgment, {'confirm': True}, name='talk-confirm-by-staff'),
url(r'^staff/talks/(?P<talk_id>[0-9]+)/desist/$', views.talk_acknowledgment, {'confirm': False}, name='talk-desist-by-staff'),
url(r'^staff/talks/(?P<pk>[0-9]+)/edit/$', views.TalkUpdate.as_view(), name='talk-edit'),
url(r'^staff/talks/(?P<talk_id>[0-9]+)/edit/$', views.TalkUpdate.as_view(), name='talk-edit'),
# url(r'^staff/talks/(?P<talk_id>[0-9]+)/speaker/add/$', views.talk_speaker_add, name='talk-speaker-add'), TODO WIP
url(r'^staff/talks/(?P<talk_id>[0-9]+)/speaker/remove/(?P<participant_id>[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<participant_id>[0-9]+)/$', views.participant_details, name='participant-details'),
url(r'^staff/speakers/(?P<participant_id>[0-9]+)/add-talk/$', views.participant_add_talk, name='participant-add-talk'),
url(r'^staff/speakers/(?P<pk>[0-9]+)/edit/$', views.ParticipantUpdate.as_view(), name='participant-edit'),
url(r'^staff/speakers/(?P<participant_id>[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<slug>[-\w]+)/edit/$', views.TrackUpdate.as_view(), name='track-edit'),

View File

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