use pk instead of token in staff area

This commit is contained in:
Élie Bouttier 2017-11-25 22:41:21 +01:00
parent 42edc32880
commit 476dd3fbd4
13 changed files with 62 additions and 70 deletions

View File

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

View File

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

View File

@ -10,7 +10,7 @@
{% if participant.vip %}<span class="badge">{% trans "VIP" %}</span>{% endif %}
</h1>
<p><a class="btn btn-success" href="{% url 'participant-edit' participant.token %}">{% trans "Edit" %}</a></p>
<p><a class="btn btn-success" href="{% url 'participant-edit' participant.pk %}">{% trans "Edit" %}</a></p>
<h2>{% trans "Biography" %}</h2>
<p>{{ participant.biography|linebreaksbr }}</p>
@ -41,10 +41,10 @@
<h3>{{ category.list.0.category }}</h3>
<ul>{% for talk in category.list %}
<li>
<a href="{% url 'talk-details' talk.token %}">{{ talk }}</a>
<a href="{% url 'talk-details' talk.pk %}">{{ talk }}</a>
<i>{% trans "by" %}</i>
{% for p in talk.speakers.all %}
{% if p == participant %}{{ p }}{% else %}<a href="{% url 'participant-details' p.token %}">{{ p }}</a>{% endif %}
{% if p == participant %}{{ p }}{% else %}<a href="{% url 'participant-details' p.pk %}">{{ p }}</a>{% endif %}
{% if forloop.revcounter == 2 %} {% trans "and" %} {% elif not forloop.last %}, {% endif %}
{% endfor %}
{% if talk.track %}

View File

@ -13,7 +13,7 @@
{% endif %}
</h1>
{% url 'participant-details' participant.token as cancel_url %}
{% url 'participant-details' participant.pk as cancel_url %}
{% include '_form.html' %}
{% endblock %}

View File

@ -59,7 +59,7 @@
{% endif %}
<tr>
<td>
<a href="{% url 'participant-details' participant.token %}">{{ participant }}</a>
<a href="{% url 'participant-details' participant.pk %}">{{ participant }}</a>
{% if participant.vip %}<span class="badge pull-right">VIP</span>{% endif %}
</td>
<td>

View File

@ -17,7 +17,7 @@
<a href="{{ talk.get_absolute_url }}"><strong>{{ talk }}</strong></a>
{% for participant in talk.speakers.all %}
{% if forloop.first %} &ndash; <em>{% endif %}
<a href="{% url 'participant-details' participant.token %}">{{ participant }}</a>
<a href="{% url 'participant-details' participant.pk %}">{{ participant }}</a>
{% if forloop.revcounter == 2 %} {% trans "and" %} {% elif not forloop.last %}, {% endif %}
{% if forloop.last %}</em>{% endif %}
{% endfor %}
@ -35,7 +35,7 @@
<a href="{{ talk.get_absolute_url }}"><strong>{{ talk }}</strong></a>
{% for participant in talk.speakers.all %}
{% if forloop.first %} &ndash; <em>{% endif %}
<a href="{% url 'participant-details' participant.token %}">{{ participant }}</a>
<a href="{% url 'participant-details' participant.pk %}">{{ participant }}</a>
{% if forloop.revcounter == 2 %} {% trans "and" %} {% elif not forloop.last %}, {% endif %}
{% if forloop.last %}</em>{% endif %}
{% endfor %}

View File

@ -19,7 +19,7 @@
<textarea name="message" class="form-control" rows="5"></textarea>
</div>
<button type="submit" class="btn btn-{% if accept %}success{% else %}danger{% endif %}">{% if accept %}{% trans "Accept the proposal" %}{% else %}{% trans "Decline the proposal" %}{% endif %}</button>
<a class="btn btn-default" href="{% url 'talk-details' talk.token %}">{% trans "Cancel" %}</a>
<a class="btn btn-default" href="{% url 'talk-details' talk.pk %}">{% trans "Cancel" %}</a>
</form>
{% endblock %}

View File

@ -7,7 +7,7 @@
<h1>{{ talk.title }}</h1>
<p><a class="btn btn-success" href="{% url 'talk-edit' talk.token %}">{% trans "Edit" %}</a></p>
<p><a class="btn btn-success" href="{% url 'talk-edit' talk.pk %}">{% trans "Edit" %}</a></p>
<h3>{% trans "Information" %}</h3>
@ -69,7 +69,7 @@
{% for participant in talk.speakers.all %}
{% if forloop.first %}<ul>{% endif %}
<li>
<a href="{% url 'participant-details' participant.token %}">{{ participant }}</a>
<a href="{% url 'participant-details' participant.pk %}">{{ 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>
@ -87,22 +87,22 @@
<p>
<div class="btn-group" role="group" aria-label="vote">
<a class="btn {% if vote == -2 %} active {% endif %}btn-danger" href="{% url 'talk-vote' talk.token '-2' %}">-2</a>
<a class="btn {% if vote == -1 %} active {% endif %}btn-warning" href="{% url 'talk-vote' talk.token '-1' %}">-1</a>
<a class="btn {% if vote == 0 %} active {% endif %}btn-default" href="{% url 'talk-vote' talk.token '0' %}"> 0</a>
<a class="btn {% if vote == 1 %} active {% endif %}btn-info" href="{% url 'talk-vote' talk.token '+1' %}">+1</a>
<a class="btn {% if vote == 2 %} active {% endif %}btn-success" href="{% url 'talk-vote' talk.token '+2' %}">+2</a>
<a class="btn {% if vote == -2 %} active {% endif %}btn-danger" href="{% url 'talk-vote' talk.pk '-2' %}">-2</a>
<a class="btn {% if vote == -1 %} active {% endif %}btn-warning" href="{% url 'talk-vote' talk.pk '-1' %}">-1</a>
<a class="btn {% if vote == 0 %} active {% endif %}btn-default" href="{% url 'talk-vote' talk.pk '0' %}"> 0</a>
<a class="btn {% if vote == 1 %} active {% endif %}btn-info" href="{% url 'talk-vote' talk.pk '+1' %}">+1</a>
<a class="btn {% if vote == 2 %} active {% endif %}btn-success" href="{% url 'talk-vote' talk.pk '+2' %}">+2</a>
</div>
</p>
<p>{{ talk.vote_set.count }} {% trans "vote" %}{{ talk.vote_set.count|pluralize }}, {% trans "average:" %} {{ talk.score|floatformat:1 }}</p>
<a href="{% url 'talk-accept' talk.token %}" class="btn btn-success">{% trans "Accept" %}</a>
<a href="{% url 'talk-decline' talk.token %}" class="btn btn-danger">{% trans "Decline" %}</a>
<a href="{% url 'talk-accept' talk.pk %}" class="btn btn-success">{% trans "Accept" %}</a>
<a href="{% url 'talk-decline' talk.pk %}" class="btn btn-danger">{% trans "Decline" %}</a>
{% elif talk.accepted == True and talk.confirmed == None %}
<h3>{% trans "Speaker confirmation" %}</h3>
<a href="{% url 'talk-confirm-by-staff' talk.token %}" class="btn btn-success">{% trans "The speaker confirmed" %}</a>
<a href="{% url 'talk-desist-by-staff' talk.token %}" class="btn btn-danger">{% trans "The speaker cancelled" %}</a>
<a href="{% url 'talk-confirm-by-staff' talk.pk %}" class="btn btn-success">{% trans "The speaker confirmed" %}</a>
<a href="{% url 'talk-desist-by-staff' talk.pk %}" class="btn btn-danger">{% trans "The speaker cancelled" %}</a>
{% endif %}
{% comment %}

View File

@ -8,10 +8,10 @@
<h1>
{% if talk %}
{% trans "Edit a talk" %}
{% url 'talk-details' talk.token as cancel_url %}
{% url 'talk-details' talk.pk as cancel_url %}
{% else %}
{% trans "Add a talk" %}
{% url 'participant-details' participant.token as cancel_url %}
{% url 'participant-details' participant.pk as cancel_url %}
{% endif %}
</h1>

View File

@ -60,12 +60,12 @@
<tbody>
{% endif %}
<tr class="{{ talk.get_status_color }}">
<td><input type="checkbox" name="talks" value="{{ talk.token }}"></td>
<td><a href="{% url 'talk-details' talk.token %}">{{ talk.title }}</a></td>
<td><input type="checkbox" name="talks" value="{{ talk.pk }}"></td>
<td><a href="{% url 'talk-details' talk.pk %}">{{ talk.title }}</a></td>
<td>{{ talk.category }}</td>
<td>
{% for participant in talk.speakers.all %}
<a href="{% url 'participant-details' participant.token %}">{{ participant }}</a>
<a href="{% url 'participant-details' participant.pk %}">{{ participant }}</a>
{% if forloop.revcounter == 2 %} {% trans "and" %} {% elif not forloop.last %}, {% endif %}
{% empty %}
{% endfor %}

View File

@ -51,7 +51,7 @@ class VolunteersTests(TestCase):
response = self.client.post(reverse('volunteer-enrole'), {'name': 'B', 'email': 'b@example.org'})
self.assertEqual(Volunteer.objects.count(), n+1)
v = Volunteer.objects.get(name='B')
self.assertRedirects(response, reverse('volunteer-dashboard', kwargs=dict(volunteer_token=v.token)),
self.assertRedirects(response, reverse('volunteer-dashboard', kwargs={'volunteer_token': v.token}),
status_code=302, target_status_code=200)
def test_enrole_logged_in(self):
@ -76,25 +76,25 @@ class VolunteersTests(TestCase):
response = self.client.post(reverse('volunteer-enrole'), {'name': 'B'})
self.assertEqual(Volunteer.objects.count(), n+1)
v = Volunteer.objects.get(name='B')
self.assertRedirects(response, reverse('volunteer-dashboard', kwargs=dict(volunteer_token=v.token)),
self.assertRedirects(response, reverse('volunteer-dashboard', kwargs={'volunteer_token': v.token}),
status_code=302, target_status_code=200)
self.assertRedirects(self.client.get(reverse('volunteer-enrole')), reverse('volunteer-dashboard'))
def test_home(self):
v = Volunteer.objects.get(name='A')
self.assertEqual(self.client.get(reverse('volunteer-dashboard', kwargs=dict(volunteer_token=v.token))).status_code, 200)
self.assertEqual(self.client.get(reverse('volunteer-dashboard', kwargs={'volunteer_token': v.token})).status_code, 200)
def test_update_activity(self):
v = Volunteer.objects.get(name='A')
a = Activity.objects.get(name='Everythings')
self.assertEqual(self.client.get(reverse('volunteer-join', kwargs=dict(volunteer_token=v.token, activity=a.pk))).status_code, 404)
self.assertEqual(self.client.get(reverse('volunteer-join', kwargs={'volunteer_token': v.token, 'activity': a.pk})).status_code, 404)
conf = Conference.objects.first()
conf.volunteers_opening_date = timezone.now() - timedelta(hours=1)
conf.save()
self.assertRedirects(self.client.get(reverse('volunteer-join', kwargs=dict(volunteer_token=v.token, activity=a.slug))),
reverse('volunteer-dashboard', kwargs=dict(volunteer_token=v.token)), status_code=302, target_status_code=200)
self.assertRedirects(self.client.get(reverse('volunteer-quit', kwargs=dict(volunteer_token=v.token, activity=a.slug))),
reverse('volunteer-dashboard', kwargs=dict(volunteer_token=v.token)), status_code=302, target_status_code=200)
self.assertRedirects(self.client.get(reverse('volunteer-join', kwargs={'volunteer_token': v.token, 'activity': a.slug})),
reverse('volunteer-dashboard', kwargs={'volunteer_token': v.token}), status_code=302, target_status_code=200)
self.assertRedirects(self.client.get(reverse('volunteer-quit', kwargs={'volunteer_token': v.token, 'activity': a.slug})),
reverse('volunteer-dashboard', kwargs={'volunteer_token': v.token}), status_code=302, target_status_code=200)
def test_volunteer_mail_token(self):
v = Volunteer.objects.get(name='A')
@ -418,7 +418,7 @@ class StaffTest(TestCase):
def test_speaker_details(self):
speaker1 = Participant.objects.get(name='Speaker 1')
speaker2 = Participant.objects.get(name='Speaker 2')
url = reverse('participant-details', kwargs={'participant_id': speaker1.token})
url = reverse('participant-details', kwargs={'participant_id': speaker1.pk})
self.assertRedirects(self.client.get(url), reverse('login') + '?next=' + url)
self.client.login(username='admin', password='admin')
response = self.client.get(url)
@ -431,7 +431,7 @@ class StaffTest(TestCase):
def test_speaker_edit(self):
speaker = Participant.objects.get(name='Speaker 1')
url = reverse('participant-edit', kwargs={'participant_id': speaker.token})
url = reverse('participant-edit', kwargs={'participant_id': speaker.pk})
self.assertRedirects(self.client.get(url), reverse('login') + '?next=' + url)
self.client.login(username='admin', password='admin')
response = self.client.get(url)
@ -440,7 +440,7 @@ class StaffTest(TestCase):
'name': 'New name',
'email': 'new-mail@example.org',
'biography': 'New bio',
}), reverse('participant-details', kwargs={'participant_id': speaker.token}))
}), reverse('participant-details', kwargs={'participant_id': speaker.pk}))
speaker = Participant.objects.get(pk=speaker.pk)
self.assertEquals(speaker.name, 'New name')
self.assertEquals(speaker.email, 'new-mail@example.org')
@ -467,7 +467,7 @@ class StaffTest(TestCase):
def test_talk_details(self):
talk = Talk.objects.get(title='Talk 1')
url = reverse('talk-details', kwargs=dict(talk_id=talk.token))
url = reverse('talk-details', kwargs=dict(talk_id=talk.pk))
self.assertRedirects(self.client.get(url), reverse('login') + '?next=' + url)
self.client.login(username='admin', password='admin')
response = self.client.get(url)
@ -483,7 +483,7 @@ class StaffTest(TestCase):
self.assertRedirects(self.client.get(url), reverse('login') + '?next=' + url)
self.client.login(username='admin', password='admin')
response = self.client.get(url)
self.assertRedirects(response, reverse('talk-details', kwargs={'talk_id': talk.token}))
self.assertRedirects(response, reverse('talk-details', kwargs={'talk_id': talk.pk}))
talk = Talk.objects.get(title='Talk 1')
self.assertEquals(talk.speakers.count() + 1, count)
self.assertFalse(to_remove in talk.speakers.all())

View File

@ -28,20 +28,20 @@ urlpatterns = [
#url(r'^speaker/(?P<participant_id>[\w\-]+)/$', views.speaker_show, name='show-speaker'),
url(r'^staff/$', views.staff, name='staff'),
url(r'^staff/talks/$', views.talk_list, name='talk-list'),
url(r'^staff/talks/(?P<talk_id>[\w\-]+)/$', views.talk_details, name='talk-details'),
url(r'^staff/talks/(?P<talk_id>[\w\-]+)/vote/(?P<score>[-+0-2]+)/$', views.talk_vote, name='talk-vote'),
url(r'^staff/talks/(?P<talk_id>[\w\-]+)/accept/$', views.talk_decide, {'accept': True}, name='talk-accept'),
url(r'^staff/talks/(?P<talk_id>[\w\-]+)/decline/$', views.talk_decide, {'accept': False}, name='talk-decline'),
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>[0-9]+)/$', views.talk_details, name='talk-details'),
url(r'^staff/talks/(?P<talk_id>[0-9]+)/vote/(?P<score>[-+0-2]+)/$', views.talk_vote, name='talk-vote'),
url(r'^staff/talks/(?P<talk_id>[0-9]+)/accept/$', views.talk_decide, {'accept': True}, name='talk-accept'),
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]+)/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>[\w\-]+)/$', views.participant_details, name='participant-details'),
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<participant_id>[\w\-]+)/edit/$', views.ParticipantUpdate.as_view(), name='participant-edit'),
url(r'^staff/speakers/(?P<pk>[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

@ -89,7 +89,7 @@ Thanks!
recipient_list=['%s <%s>' % (volunteer.name, volunteer.email)],
)
messages.success(request, _('Thank you for your participation! You can now subscribe to some activities.'))
return redirect(reverse('volunteer-dashboard', kwargs=dict(volunteer_token=volunteer.token)))
return redirect(reverse('volunteer-dashboard', kwargs={'volunteer_token': volunteer.token}))
return render(request, 'cfp/volunteer_enrole.html', {
'activities': Activity.objects.filter(site=request.conference.site),
'form': form,
@ -489,7 +489,7 @@ def proposal_speaker_remove(request, speaker, talk_id, co_speaker_id):
@staff_required
def talk_acknowledgment(request, talk_id, confirm):
talk = get_object_or_404(Talk, token=talk_id, site=request.conference.site)
talk = get_object_or_404(Talk, pk=talk_id, site=request.conference.site)
if not talk.accepted or talk.confirmed == confirm:
raise PermissionDenied
# TODO: handle multiple speakers case
@ -585,8 +585,8 @@ def talk_list(request):
action_form = TalkActionForm(request.POST or None, talks=talks, site=request.conference.site)
if request.method == 'POST' and action_form.is_valid():
data = action_form.cleaned_data
for talk in data['talks']:
talk = Talk.objects.get(site=request.conference.site, token=talk)
for talk_id in data['talks']:
talk = Talk.objects.get(site=request.conference.site, pk=talk_id)
if data['decision'] != None and data['decision'] != talk.accepted:
if data['decision']:
note = _("The talk has been accepted.")
@ -651,7 +651,7 @@ def talk_list(request):
@staff_required
def talk_details(request, talk_id):
talk = get_object_or_404(Talk, token=talk_id, site=request.conference.site)
talk = get_object_or_404(Talk, pk=talk_id, site=request.conference.site)
try:
vote = talk.vote_set.get(user=request.user).vote
except Vote.DoesNotExist:
@ -664,7 +664,7 @@ def talk_details(request, talk_id):
message.thread = talk.conversation
message.save()
messages.success(request, _('Message sent!'))
return redirect(reverse('talk-details', args=[talk.token]))
return redirect(reverse('talk-details', args=[talk.pk]))
return render(request, 'cfp/staff/talk_details.html', {
'talk': talk,
'vote': vote,
@ -673,7 +673,7 @@ def talk_details(request, talk_id):
@staff_required
def talk_vote(request, talk_id, score):
talk = get_object_or_404(Talk, token=talk_id, site=request.conference.site)
talk = get_object_or_404(Talk, pk=talk_id, site=request.conference.site)
vote, created = Vote.objects.get_or_create(talk=talk, user=request.user)
vote.vote = int(score)
vote.save()
@ -683,7 +683,7 @@ def talk_vote(request, talk_id, score):
@staff_required
def talk_decide(request, talk_id, accept):
talk = get_object_or_404(Talk, token=talk_id, site=request.conference.site)
talk = get_object_or_404(Talk, pk=talk_id, site=request.conference.site)
if request.method == 'POST':
talk.accepted = accept
talk.save()
@ -774,7 +774,7 @@ def participant_list(request):
@staff_required
def participant_details(request, participant_id):
participant = get_object_or_404(Participant, token=participant_id, site=request.conference.site)
participant = get_object_or_404(Participant, pk=participant_id, site=request.conference.site)
message_form = MessageForm(request.POST or None)
if request.method == 'POST' and message_form.is_valid():
message = message_form.save(commit=False)
@ -783,7 +783,7 @@ def participant_details(request, participant_id):
message.thread = participant.conversation
message.save()
messages.success(request, _('Message sent!'))
return redirect(reverse('participant-details', args=[participant.token]))
return redirect(reverse('participant-details', args=[participant.pk]))
return render(request, 'cfp/staff/participant_details.html', {
'participant': participant,
})
@ -791,9 +791,6 @@ def participant_details(request, participant_id):
class ParticipantCreate(StaffRequiredMixin, OnSiteFormMixin, CreateView):
model = Participant
slug_field = 'token'
slug_url_kwarg = 'participant_id'
#form_class = ParticipantStaffForm
template_name = 'cfp/staff/participant_form.html'
def get_form_class(self):
@ -806,9 +803,6 @@ class ParticipantCreate(StaffRequiredMixin, OnSiteFormMixin, CreateView):
class ParticipantUpdate(StaffRequiredMixin, OnSiteFormMixin, UpdateView):
model = Participant
slug_field = 'token'
slug_url_kwarg = 'participant_id'
#form_class = ParticipantStaffForm
template_name = 'cfp/staff/participant_form.html'
def get_form_class(self):
@ -828,7 +822,7 @@ def participant_add_talk(request, participant_id):
talk.site = request.conference.site
talk.save()
talk.speakers.add(participant)
return redirect(reverse('talk-details', kwargs=dict(talk_id=talk.token)))
return redirect(reverse('talk-details', kwargs={'talk_id': talk.pk}))
return render(request, 'cfp/staff/talk_form.html', {
'form': form,
'participant': participant,
@ -880,8 +874,6 @@ You can now:
class TalkUpdate(StaffRequiredMixin, OnSiteMixin, OnSiteFormMixin, UpdateView):
model = Talk
slug_field = 'token'
slug_url_kwarg = 'talk_id'
form_class = TalkStaffForm
template_name = 'cfp/staff/talk_form.html'