main image weirdness

This commit is contained in:
Sanjay B 2013-09-23 20:51:11 +05:30
parent 15c926c266
commit 61616293c8

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: