Merge branch 'stable/1.5.x'

This commit is contained in:
Oskar Hahn 2014-01-12 13:38:07 +01:00
commit d72fe39da6
2 changed files with 14 additions and 4 deletions

View File

@ -273,13 +273,15 @@ class Item(SlideMixin, AbsoluteUrlMixin, 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

View File

@ -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')