From 8631ed7f649cd665eb8a0b6825ab3542ef1ccffd Mon Sep 17 00:00:00 2001 From: Sanj Date: Thu, 15 Dec 2011 23:46:49 +0530 Subject: [PATCH] dont die for 0 images on meetings --- itf/festival/models.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/itf/festival/models.py b/itf/festival/models.py index 15417bb..8e9b166 100755 --- a/itf/festival/models.py +++ b/itf/festival/models.py @@ -50,8 +50,11 @@ class Meeting(ItfModel): return self.preview_dict() def main_image(self): - img = Image.objects.filter(meeting=self)[0] - return img.file + if Image.objects.filter(meeting=self).count() > 0: + img = Image.objects.filter(meeting=self)[0] + return img.file + else: + return None def info_dict(self): meeting_data = {}