fix error for models without galleries attr
This commit is contained in:
parent
ce6680f8b0
commit
85e6d5f524
|
@ -132,7 +132,7 @@ class ItfModel(models.Model):
|
||||||
|
|
||||||
def get_gallery_image(self):
|
def get_gallery_image(self):
|
||||||
from mediagallery.models import Photo
|
from mediagallery.models import Photo
|
||||||
if self.galleries:
|
if hasattr(self, 'galleries'):
|
||||||
qset = Photo.objects.filter(album__in=self.galleries.all())
|
qset = Photo.objects.filter(album__in=self.galleries.all())
|
||||||
if qset.count() == 0:
|
if qset.count() == 0:
|
||||||
return None
|
return None
|
||||||
|
@ -144,7 +144,7 @@ class ItfModel(models.Model):
|
||||||
def get_videos(self):
|
def get_videos(self):
|
||||||
from mediagallery.models import YoutubeVideo
|
from mediagallery.models import YoutubeVideo
|
||||||
|
|
||||||
if self.galleries:
|
if hasattr(self, 'galleries'):
|
||||||
qset = YoutubeVideo.objects.filter(album__in=self.galleries.all())
|
qset = YoutubeVideo.objects.filter(album__in=self.galleries.all())
|
||||||
if qset.count() == 0:
|
if qset.count() == 0:
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -130,9 +130,9 @@ class Person(ItfModel):
|
||||||
}
|
}
|
||||||
|
|
||||||
def related_scripts(self):
|
def related_scripts(self):
|
||||||
prod_scripts = [ p.script for p in self.productions.all() ]
|
#prod_scripts = [ p.script for p in self.productions.all() ]
|
||||||
prod_scripts.extend( [ p.script for p in self.productions_authored.all() ] )
|
prod_scripts = [ p.script for p in self.productions_authored.all() ]
|
||||||
prod_scripts.extend( [ p.script for p in self.productions_directed.all() ] )
|
#prod_scripts.extend( [ p.script for p in self.productions_directed.all() ] )
|
||||||
#auth_scripts = Script.objects.filter(author__iexact=)
|
#auth_scripts = Script.objects.filter(author__iexact=)
|
||||||
return prod_scripts
|
return prod_scripts
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user