Merge pull request #691 from ostcar/issue-682

Fixed #682 Error if a group was added to a list of speakers
This commit is contained in:
Oskar Hahn 2013-06-01 05:39:31 -07:00
commit 0b39f2b536
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"))
@models.permalink
def get_absolute_url(self, link='view'):
def get_absolute_url(self, link='detail'):
"""
Return the URL to this user group.
@ -148,7 +148,7 @@ class Group(PersonMixin, Person, SlideMixin, DjangoGroup):
* edit
* delete
"""
if link == 'view':
if link == 'detail' or link == 'view':
return ('user_group_view', [str(self.id)])
if link == 'edit':
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.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.config.api import config
@ -143,6 +143,15 @@ class TestAgendaItemView(SpeakerViewTestCase):
'/agenda/1/', {'speaker': self.speaker1.person_id})
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):
def test_get(self):