get main images
This commit is contained in:
parent
291fe9822f
commit
2449ade7c0
|
@ -115,6 +115,17 @@ class ItfModel(models.Model):
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
|
||||||
|
def get_gallery_image(self):
|
||||||
|
from mediagallery.models import Photo
|
||||||
|
if self.galleries:
|
||||||
|
qset = Photo.objects.filter(album__in=self.galleries.all())
|
||||||
|
if qset.count() == 0:
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
return qset[0].image
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
def get_videos(self):
|
def get_videos(self):
|
||||||
from mediagallery.models import YoutubeVideo
|
from mediagallery.models import YoutubeVideo
|
||||||
|
|
||||||
|
@ -240,10 +251,11 @@ class ItfModel(models.Model):
|
||||||
imgfield = self.get_modelextra().default_image
|
imgfield = self.get_modelextra().default_image
|
||||||
|
|
||||||
if imgfield:
|
if imgfield:
|
||||||
try:
|
#try:
|
||||||
thumb = get_thumbnail(imgfield, size, crop="center").url
|
thumb = get_thumbnail(imgfield, size, crop="center").url
|
||||||
except:
|
#except:
|
||||||
thumb = 'http://placehold.it/%s' % size
|
# print imgfield.url
|
||||||
|
# thumb = 'http://placehold.it/%s' % size
|
||||||
else:
|
else:
|
||||||
thumb = 'http://placehold.it/%s' % size # Add default image for site
|
thumb = 'http://placehold.it/%s' % size # Add default image for site
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -56,6 +56,9 @@ class Event(ItfModel):
|
||||||
def get_title(self):
|
def get_title(self):
|
||||||
return self.__unicode__()
|
return self.__unicode__()
|
||||||
|
|
||||||
|
def main_image(self):
|
||||||
|
return self.image
|
||||||
|
|
||||||
def get_dict(self):
|
def get_dict(self):
|
||||||
# links = self.connections.all().order_by('link_type')
|
# links = self.connections.all().order_by('link_type')
|
||||||
# link_keys = self.connections.all().values_list['link_type'].distinct()
|
# link_keys = self.connections.all().values_list['link_type'].distinct()
|
||||||
|
|
|
@ -76,6 +76,9 @@ class Person(ItfModel):
|
||||||
def get_title(self):
|
def get_title(self):
|
||||||
return self.__unicode__()
|
return self.__unicode__()
|
||||||
|
|
||||||
|
def main_image(self):
|
||||||
|
return self.image
|
||||||
|
|
||||||
def get_dict(self):
|
def get_dict(self):
|
||||||
#lconnections = [obj for obj in self.connections.all()]
|
#lconnections = [obj for obj in self.connections.all()]
|
||||||
#rconnections = [ obj for obj in PersonPerson.objects.filter(person2=self)
|
#rconnections = [ obj for obj in PersonPerson.objects.filter(person2=self)
|
||||||
|
@ -435,6 +438,9 @@ class Production(ItfModel):
|
||||||
return True
|
return True
|
||||||
return self.group.user_has_perms(user)
|
return self.group.user_has_perms(user)
|
||||||
|
|
||||||
|
def main_image(self):
|
||||||
|
return self.get_gallery_image()
|
||||||
|
|
||||||
def get_people(self):
|
def get_people(self):
|
||||||
persons = [{"person":self.director, "role":"director", "assoc_type":'production', "assoc_name":self.name },
|
persons = [{"person":self.director, "role":"director", "assoc_type":'production', "assoc_name":self.name },
|
||||||
{"person":self.playwright, "role":"playwright", "assoc_type":'production', "assoc_name":self.name }
|
{"person":self.playwright, "role":"playwright", "assoc_type":'production', "assoc_name":self.name }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user