Merge pull request #1181 from ostcar/related_list_of_speakers
Fixed agenda_item.is_active_slide() with related item and list of speakers
This commit is contained in:
commit
5a123ade23
@ -272,13 +272,15 @@ class Item(SlideMixin, MPTTModel):
|
|||||||
|
|
||||||
def is_active_slide(self):
|
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.
|
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()
|
value = self.content_object.is_active_slide()
|
||||||
else:
|
else:
|
||||||
value = super(Item, self).is_active_slide()
|
value = False
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
@ -97,7 +97,15 @@ class ItemTest(TestCase):
|
|||||||
The agenda item has to be active, if its related item is.
|
The agenda item has to be active, if its related item is.
|
||||||
"""
|
"""
|
||||||
set_active_slide('test_related_item', pk=1)
|
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):
|
def test_bad_related_item(self):
|
||||||
bad = BadRelatedItem.objects.create(name='dhfne94irkgl2047fzvb')
|
bad = BadRelatedItem.objects.create(name='dhfne94irkgl2047fzvb')
|
||||||
|
Loading…
Reference in New Issue
Block a user