From 476dd3fbd4e00d982ed678649b50f1209737bbc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lie=20Bouttier?= Date: Sat, 25 Nov 2017 22:41:21 +0100 Subject: [PATCH] use pk instead of token in staff area --- cfp/forms.py | 2 +- cfp/models.py | 8 ++--- .../cfp/staff/participant_details.html | 6 ++-- cfp/templates/cfp/staff/participant_form.html | 2 +- cfp/templates/cfp/staff/participant_list.html | 2 +- cfp/templates/cfp/staff/room_details.html | 4 +-- cfp/templates/cfp/staff/talk_decide.html | 2 +- cfp/templates/cfp/staff/talk_details.html | 22 +++++++------- cfp/templates/cfp/staff/talk_form.html | 4 +-- cfp/templates/cfp/staff/talk_list.html | 6 ++-- cfp/tests.py | 26 ++++++++-------- cfp/urls.py | 18 +++++------ cfp/views.py | 30 +++++++------------ 13 files changed, 62 insertions(+), 70 deletions(-) diff --git a/cfp/forms.py b/cfp/forms.py index f2e4f1a..1ca5173 100644 --- a/cfp/forms.py +++ b/cfp/forms.py @@ -187,7 +187,7 @@ class TalkActionForm(forms.Form): site = kwargs.pop('site') talks = kwargs.pop('talks') super().__init__(*args, **kwargs) - self.fields['talks'].choices = [(talk.token, None) for talk in talks.all()] + self.fields['talks'].choices = [(talk.pk, None) for talk in talks.all()] tracks = Track.objects.filter(site=site) self.fields['track'].choices = [(None, "---------")] + list(tracks.values_list('slug', 'name')) tags = Tag.objects.filter(site=site) diff --git a/cfp/models.py b/cfp/models.py index 2b523c6..c7feab2 100644 --- a/cfp/models.py +++ b/cfp/models.py @@ -117,7 +117,7 @@ class Participant(PonyConfModel): objects = ParticipantManager() def get_absolute_url(self): - return reverse('participant-details', kwargs=dict(participant_id=self.token)) + return reverse('participant-details', kwargs={'participant_id': self.pk}) def get_secret_url(self, full=False): url = reverse('proposal-dashboard', kwargs={'speaker_token': self.token}) @@ -422,7 +422,7 @@ class Talk(PonyConfModel): return self.duration or self.category.duration def get_absolute_url(self): - return reverse('talk-details', kwargs={'talk_id': self.token}) + return reverse('talk-details', kwargs={'talk_id': self.pk}) @property def end_date(self): @@ -467,10 +467,10 @@ class Volunteer(PonyConfModel): conversation = models.OneToOneField(MessageThread) def get_absolute_url(self): - return reverse('volunteer-details', kwargs=dict(volunteer_id=self.pk)) + return reverse('volunteer-details', kwargs={'volunteer_id': self.pk}) def get_secret_url(self, full=False): - url = reverse('volunteer-dashboard', kwargs=dict(volunteer_token=self.token)) + url = reverse('volunteer-dashboard', kwargs={'volunteer_token': self.token}) if full: url = ('https' if self.site.conference.secure_domain else 'http') + '://' + self.site.domain + url return url diff --git a/cfp/templates/cfp/staff/participant_details.html b/cfp/templates/cfp/staff/participant_details.html index f6ef4f9..323343b 100644 --- a/cfp/templates/cfp/staff/participant_details.html +++ b/cfp/templates/cfp/staff/participant_details.html @@ -10,7 +10,7 @@ {% if participant.vip %}{% trans "VIP" %}{% endif %} -

{% trans "Edit" %}

+

{% trans "Edit" %}

{% trans "Biography" %}

{{ participant.biography|linebreaksbr }}

@@ -41,10 +41,10 @@

{{ category.list.0.category }}