This commit is contained in:
Johnson Chetty 2013-09-23 17:24:19 +02:00
commit f447026581

View File

@ -253,17 +253,15 @@ class ItfModel(models.Model):
Get the main image thumbnail for this object - checks if object has either a field or custom method called 'main_image', then checks for default_images on the ModelExtra for this model.
'''
def get_main_image(self, size="142x150"):
imgfield = None
if hasattr(self, 'main_image'):
main_image_getter = self.main_image
if type(main_image_getter).__name__ == 'instancemethod':
imgfield = main_image_getter()
else:
imgfield = main_image_getter
else:
imgfield = self.get_modelextra().default_image #FIXME!!
if imgfield is None or imgfield.name == '' and self.get_modelextra():
if imgfield is None or imgfield.name == '':
imgfield = self.get_modelextra().default_image
if imgfield: