From 378c61f7434f8e8aa3905b0813a46fef65992214 Mon Sep 17 00:00:00 2001 From: Sanj Date: Mon, 2 Jan 2012 23:59:30 +0530 Subject: [PATCH] main image should get default model extra image correctly --- itf/app/models.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/itf/app/models.py b/itf/app/models.py index 5cd5da7..9f3cff5 100755 --- a/itf/app/models.py +++ b/itf/app/models.py @@ -87,20 +87,19 @@ class ItfModel(models.Model): - def get_main_image(self): + def get_main_image(self, size="142x150"): 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 - elif self.get_modelextra().default_image: + if imgfield.name == '': imgfield = self.get_modelextra().default_image - else: - imgfield = None - if imgfield is not None: + + if imgfield: try: - thumb = get_thumbnail(imgfield, "142x150", crop="center").url + thumb = get_thumbnail(imgfield, size, crop="center").url except: thumb = '' else: