From 85e6d5f5248f974fe2d71ff474d36ef0ed2a24c6 Mon Sep 17 00:00:00 2001 From: Sanjay B Date: Sun, 2 Aug 2015 16:07:50 +0530 Subject: [PATCH] fix error for models without galleries attr --- itf/app/models.py | 4 ++-- itf/itfprofiles/models.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/itf/app/models.py b/itf/app/models.py index c4ab935..ffffd4f 100755 --- a/itf/app/models.py +++ b/itf/app/models.py @@ -132,7 +132,7 @@ class ItfModel(models.Model): def get_gallery_image(self): from mediagallery.models import Photo - if self.galleries: + if hasattr(self, 'galleries'): qset = Photo.objects.filter(album__in=self.galleries.all()) if qset.count() == 0: return None @@ -144,7 +144,7 @@ class ItfModel(models.Model): def get_videos(self): from mediagallery.models import YoutubeVideo - if self.galleries: + if hasattr(self, 'galleries'): qset = YoutubeVideo.objects.filter(album__in=self.galleries.all()) if qset.count() == 0: return False diff --git a/itf/itfprofiles/models.py b/itf/itfprofiles/models.py index 1df0a78..bb817ff 100644 --- a/itf/itfprofiles/models.py +++ b/itf/itfprofiles/models.py @@ -130,9 +130,9 @@ class Person(ItfModel): } def related_scripts(self): - prod_scripts = [ p.script for p in self.productions.all() ] - prod_scripts.extend( [ p.script for p in self.productions_authored.all() ] ) - prod_scripts.extend( [ p.script for p in self.productions_directed.all() ] ) + #prod_scripts = [ p.script for p in self.productions.all() ] + prod_scripts = [ p.script for p in self.productions_authored.all() ] + #prod_scripts.extend( [ p.script for p in self.productions_directed.all() ] ) #auth_scripts = Script.objects.filter(author__iexact=) return prod_scripts