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:
* the current slide is an item and
* the user has the permission to see the item
* the current slide is an 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.
This method also add the request.user to the list of speakers, if he
has the right permissions.
This method also adds the request.user to the list of speakers, if he
has the right permissions and the list is not closed.
"""
item = self.get_item()
request = self.request
@ -466,6 +467,10 @@ class CurrentListOfSpeakersView(RedirectView):
'Please choose the agenda item manually from the agenda.'))
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'):
try:
Speaker.objects.add(self.request.user, item)