use .name == '' to check if image field is empty
This commit is contained in:
parent
099c8671c4
commit
86388fd015
|
@ -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 ''
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user