fix error if production does not have script

This commit is contained in:
Sanjay B 2014-10-18 18:51:07 +05:30
parent 03e4db0578
commit df39a4b2b7

View File

@ -497,8 +497,12 @@ class Production(ItfModel):
def get_dict(self):
from events.models import Event
rel_level1 = [obj for obj in Production.objects.filter(script=self.script)]
rel_level2 = list(set(obj.production_set.all() for obj in self.script.related_scripts.all()))
if self.script:
rel_level1 = [obj for obj in Production.objects.filter(script=self.script)]
rel_level2 = list(set(obj.production_set.all() for obj in self.script.related_scripts.all()))
else:
rel_level1 = []
rel_level2 = []
shows = Event.objects.filter(production=self).order_by('-start_date')
last_date = None
if shows.count() > 0: