Fixed #682 Error if a group was added to a list of speakers

This commit is contained in:
Oskar Hahn 2013-06-01 09:10:15 +02:00
parent 4c296b8891
commit 4faf91424b
2 changed files with 12 additions and 3 deletions

View File

@ -139,7 +139,7 @@ class Group(PersonMixin, Person, SlideMixin, DjangoGroup):
description = models.TextField(blank=True, verbose_name=ugettext_lazy("Description")) description = models.TextField(blank=True, verbose_name=ugettext_lazy("Description"))
@models.permalink @models.permalink
def get_absolute_url(self, link='view'): def get_absolute_url(self, link='detail'):
""" """
Return the URL to this user group. Return the URL to this user group.
@ -148,7 +148,7 @@ class Group(PersonMixin, Person, SlideMixin, DjangoGroup):
* edit * edit
* delete * delete
""" """
if link == 'view': if link == 'detail' or link == 'view':
return ('user_group_view', [str(self.id)]) return ('user_group_view', [str(self.id)])
if link == 'edit': if link == 'edit':
return ('user_group_edit', [str(self.id)]) return ('user_group_edit', [str(self.id)])

View File

@ -11,7 +11,7 @@ from django.test.client import Client
from openslides.utils.exceptions import OpenSlidesError from openslides.utils.exceptions import OpenSlidesError
from openslides.utils.test import TestCase from openslides.utils.test import TestCase
from openslides.participant.models import User from openslides.participant.models import User, Group
from openslides.agenda.models import Item, Speaker from openslides.agenda.models import Item, Speaker
from openslides.config.api import config from openslides.config.api import config
@ -143,6 +143,15 @@ class TestAgendaItemView(SpeakerViewTestCase):
'/agenda/1/', {'speaker': self.speaker1.person_id}) '/agenda/1/', {'speaker': self.speaker1.person_id})
self.assertFormError(response, 'form', 'speaker', 'speaker1 is already on the list of speakers.') self.assertFormError(response, 'form', 'speaker', 'speaker1 is already on the list of speakers.')
def test_group_as_speaker(self):
"""
Test to show a group as a speaker on the agenda-view.
"""
group = Group.objects.create(name='test', group_as_person=True)
Speaker.objects.add(group, self.item1)
self.assertTrue(Speaker.objects.filter(person=group.person_id, item=self.item1).exists())
response = self.admin_client.get('/agenda/1/')
class TestSpeakerDeleteView(SpeakerViewTestCase): class TestSpeakerDeleteView(SpeakerViewTestCase):
def test_get(self): def test_get(self):