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)),
|
'stories': map(lambda x: x.get_dict(), BestPracticeStory.objects.filter(bestpractice=self)),
|
||||||
'guideline': self.guideline,
|
'guideline': self.guideline,
|
||||||
'law': self.law,
|
'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,
|
'theatre': self.theatre,
|
||||||
'quick_howto': self.quick_howto,
|
'quick_howto': self.quick_howto,
|
||||||
'category': self.category.name,
|
'category': self.category.name,
|
||||||
|
@ -80,7 +80,7 @@ class BestPracticeStory(models.Model):
|
||||||
def get_dict(self):
|
def get_dict(self):
|
||||||
return {
|
return {
|
||||||
'text': self.text,
|
'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