- {{ participant }}
+ {{ participant }}
{% if participant.vip %}VIP{% endif %}
|
diff --git a/cfp/templates/cfp/staff/room_details.html b/cfp/templates/cfp/staff/room_details.html
index 5c309ab..fe8fdce 100644
--- a/cfp/templates/cfp/staff/room_details.html
+++ b/cfp/templates/cfp/staff/room_details.html
@@ -17,7 +17,7 @@
{{ talk }}
{% for participant in talk.speakers.all %}
{% if forloop.first %} – {% endif %}
- {{ participant }}
+ {{ participant }}
{% if forloop.revcounter == 2 %} {% trans "and" %} {% elif not forloop.last %}, {% endif %}
{% if forloop.last %}{% endif %}
{% endfor %}
@@ -35,7 +35,7 @@
{{ talk }}
{% for participant in talk.speakers.all %}
{% if forloop.first %} – {% endif %}
- {{ participant }}
+ {{ participant }}
{% if forloop.revcounter == 2 %} {% trans "and" %} {% elif not forloop.last %}, {% endif %}
{% if forloop.last %}{% endif %}
{% endfor %}
diff --git a/cfp/templates/cfp/staff/talk_decide.html b/cfp/templates/cfp/staff/talk_decide.html
index 6d4ca56..2585558 100644
--- a/cfp/templates/cfp/staff/talk_decide.html
+++ b/cfp/templates/cfp/staff/talk_decide.html
@@ -19,7 +19,7 @@
- {% trans "Cancel" %}
+ {% trans "Cancel" %}
{% endblock %}
diff --git a/cfp/templates/cfp/staff/talk_details.html b/cfp/templates/cfp/staff/talk_details.html
index 9ef9459..aeb8c92 100644
--- a/cfp/templates/cfp/staff/talk_details.html
+++ b/cfp/templates/cfp/staff/talk_details.html
@@ -7,7 +7,7 @@
{{ talk.title }}
-{% trans "Edit" %}
+{% trans "Edit" %}
{% trans "Information" %}
@@ -69,7 +69,7 @@
{% for participant in talk.speakers.all %}
{% if forloop.first %}{% endif %}
-
- {{ participant }}
+ {{ participant }}
{% if participant.vip %} VIP{% endif %}
{% trans "remove" %}
@@ -87,22 +87,22 @@
{{ talk.vote_set.count }} {% trans "vote" %}{{ talk.vote_set.count|pluralize }}, {% trans "average:" %} {{ talk.score|floatformat:1 }}
-{% trans "Accept" %}
-{% trans "Decline" %}
+{% trans "Accept" %}
+{% trans "Decline" %}
{% elif talk.accepted == True and talk.confirmed == None %}
{% trans "Speaker confirmation" %}
-{% trans "The speaker confirmed" %}
-{% trans "The speaker cancelled" %}
+{% trans "The speaker confirmed" %}
+{% trans "The speaker cancelled" %}
{% endif %}
{% comment %}
diff --git a/cfp/templates/cfp/staff/talk_form.html b/cfp/templates/cfp/staff/talk_form.html
index 384f377..4e4c9c3 100644
--- a/cfp/templates/cfp/staff/talk_form.html
+++ b/cfp/templates/cfp/staff/talk_form.html
@@ -8,10 +8,10 @@
{% 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 %}
diff --git a/cfp/templates/cfp/staff/talk_list.html b/cfp/templates/cfp/staff/talk_list.html
index 2ce3a09..d639bc0 100644
--- a/cfp/templates/cfp/staff/talk_list.html
+++ b/cfp/templates/cfp/staff/talk_list.html
@@ -60,12 +60,12 @@
{% endif %}
- |
- {{ talk.title }} |
+ |
+ {{ talk.title }} |
{{ talk.category }} |
{% for participant in talk.speakers.all %}
- {{ participant }}
+ {{ participant }}
{% if forloop.revcounter == 2 %} {% trans "and" %} {% elif not forloop.last %}, {% endif %}
{% empty %}–
{% endfor %}
diff --git a/cfp/tests.py b/cfp/tests.py
index 2d13329..cf0bbe2 100644
--- a/cfp/tests.py
+++ b/cfp/tests.py
@@ -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())
diff --git a/cfp/urls.py b/cfp/urls.py
index 61645c9..3f2676d 100644
--- a/cfp/urls.py
+++ b/cfp/urls.py
@@ -28,20 +28,20 @@ urlpatterns = [
#url(r'^speaker/(?P[\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[\w\-]+)/$', views.talk_details, name='talk-details'),
- url(r'^staff/talks/(?P[\w\-]+)/vote/(?P[-+0-2]+)/$', views.talk_vote, name='talk-vote'),
- url(r'^staff/talks/(?P[\w\-]+)/accept/$', views.talk_decide, {'accept': True}, name='talk-accept'),
- url(r'^staff/talks/(?P[\w\-]+)/decline/$', views.talk_decide, {'accept': False}, name='talk-decline'),
- url(r'^staff/talks/(?P[\w\-]+)/confirm/$', views.talk_acknowledgment, {'confirm': True}, name='talk-confirm-by-staff'),
- url(r'^staff/talks/(?P[\w\-]+)/desist/$', views.talk_acknowledgment, {'confirm': False}, name='talk-desist-by-staff'),
- url(r'^staff/talks/(?P[\w\-]+)/edit/$', views.TalkUpdate.as_view(), name='talk-edit'),
+ url(r'^staff/talks/(?P[0-9]+)/$', views.talk_details, name='talk-details'),
+ url(r'^staff/talks/(?P[0-9]+)/vote/(?P[-+0-2]+)/$', views.talk_vote, name='talk-vote'),
+ url(r'^staff/talks/(?P[0-9]+)/accept/$', views.talk_decide, {'accept': True}, name='talk-accept'),
+ 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]+)/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[\w\-]+)/$', views.participant_details, name='participant-details'),
+ 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[\w\-]+)/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 01d3cd7..5982440 100644
--- a/cfp/views.py
+++ b/cfp/views.py
@@ -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'
| |