From 86388fd015d131fbdf61f0bb89d8703c2b73912d Mon Sep 17 00:00:00 2001 From: Sanj Date: Mon, 7 Mar 2011 03:28:10 +0530 Subject: [PATCH] use .name == '' to check if image field is empty --- itf/bestpractices/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/itf/bestpractices/models.py b/itf/bestpractices/models.py index ba10070..e42dfca 100644 --- a/itf/bestpractices/models.py +++ b/itf/bestpractices/models.py @@ -36,7 +36,7 @@ class BestPractice(ItfModel): 'stories': map(lambda x: x.get_dict(), BestPracticeStory.objects.filter(bestpractice=self)), 'guideline': self.guideline, 'law': self.law, - 'law_image': self.law_image if self.law_image != None else '', + 'law_image': self.law_image.url if self.law_image.name != '' else '', 'theatre': self.theatre, 'quick_howto': self.quick_howto, 'category': self.category.name, @@ -80,7 +80,7 @@ class BestPracticeStory(models.Model): def get_dict(self): return { 'text': self.text, - 'image': self.image.url if self.image != None else '' + 'image': self.image.url if self.image.name != '' else '' }