Fixed link 'Put me on the list of speakers' when the list is already closed.

This commit is contained in:
Norman Jäckel 2013-05-12 02:06:55 +02:00
parent af6659a67e
commit a469831f1f

View File

@ -450,13 +450,14 @@ class CurrentListOfSpeakersView(RedirectView):
""" """
Returns the URL to the item_view if: Returns the URL to the item_view if:
* the current slide is an item and * the current slide is an item,
* the user has the permission to see the item * the user has the permission to see the item and
* the list of speakers of the item is not closed,
in other case, it returns the URL to the dashboard. in other case, it returns the URL to the dashboard.
This method also add the request.user to the list of speakers, if he This method also adds the request.user to the list of speakers, if he
has the right permissions. has the right permissions and the list is not closed.
""" """
item = self.get_item() item = self.get_item()
request = self.request request = self.request
@ -466,6 +467,10 @@ class CurrentListOfSpeakersView(RedirectView):
'Please choose the agenda item manually from the agenda.')) 'Please choose the agenda item manually from the agenda.'))
return reverse('dashboard') return reverse('dashboard')
if item.speaker_list_closed:
messages.error(request, _('The list of speakers is closed.'))
return reverse('dashboard')
if self.request.user.has_perm('agenda.can_be_speaker'): if self.request.user.has_perm('agenda.can_be_speaker'):
try: try:
Speaker.objects.add(self.request.user, item) Speaker.objects.add(self.request.user, item)