From bbd7542341399632cd0ac3e3ced6d1406523d581 Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Sun, 12 Jan 2014 12:48:38 +0100 Subject: [PATCH] Fixed agenda_item.is_active_slide() with related item and list of speakers --- openslides/agenda/models.py | 8 +++++--- tests/agenda/tests.py | 10 +++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/openslides/agenda/models.py b/openslides/agenda/models.py index 4bf583485..5658cb89f 100644 --- a/openslides/agenda/models.py +++ b/openslides/agenda/models.py @@ -272,13 +272,15 @@ class Item(SlideMixin, MPTTModel): def is_active_slide(self): """ - Returns True if the slide is True. If the slide is a related item, + Returns True if the slide is active. If the slide is a related item, Returns True if the related object is active. """ - if self.content_object and isinstance(self.content_object, SlideMixin): + if super(Item, self).is_active_slide(): + value = True + elif self.content_object and isinstance(self.content_object, SlideMixin): value = self.content_object.is_active_slide() else: - value = super(Item, self).is_active_slide() + value = False return value diff --git a/tests/agenda/tests.py b/tests/agenda/tests.py index 821c2bbe9..164320dd9 100644 --- a/tests/agenda/tests.py +++ b/tests/agenda/tests.py @@ -97,7 +97,15 @@ class ItemTest(TestCase): The agenda item has to be active, if its related item is. """ set_active_slide('test_related_item', pk=1) - self.assertTrue(self.item5.is_active_slide) + self.assertTrue(self.item5.is_active_slide()) + + def test_is_active_related_item_list_of_speakers(self): + """ + Test the method 'is_active_slide' if the item is related but the list + of speakers is shown on the projector. + """ + set_active_slide('agenda', type='list_of_speakers', pk=5) + self.assertTrue(self.item5.is_active_slide()) def test_bad_related_item(self): bad = BadRelatedItem.objects.create(name='dhfne94irkgl2047fzvb')