Skip to content

Commit

Permalink
[examples] Update models.py (#1380)
Browse files Browse the repository at this point in the history
  • Loading branch information
HenkVanHoek authored Jun 1, 2020
1 parent ce6caa2 commit 7cffe5b
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions examples/productsale/app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,17 @@ class Product(Model):

def photo_img(self):
im = ImageManager()
productPubViewUrl = url_for("ProductPubView.show", pk=str(self.id))
if self.photo:
photoUrl = im.get_url(self.photo)
return Markup(
'<a href="' +
url_for("ProductPubView.show", pk=str(self.id)) +
'" class="thumbnail"><img src="' +
im.get_url(self.photo) +
'" alt="Photo" class="img-rounded img-responsive"></a>'
f'<a href="{productPubViewUrl}" class="thumbnail"><img src="{photoUrl}" '
f'alt="Photo" class="img-rounded img-responsive"></a>'
)
else:
return Markup(
'<a href="' +
+ url_for("ProductPubView.show", pk=str(self.id)) +
'" class="thumbnail"><img src="//:0" alt="Photo" class="img-responsive">'
'</a>'
f'<a href="{productPubViewUrl}"" class="thumbnail"><img src="//:0" '
f'alt="Photo" class="img-responsive">' '</a>'
)

def price_label(self):
Expand Down

0 comments on commit 7cffe5b

Please sign in to comment.