From 374a97e28a3aaf3d62c08fefd04c13acb4a1d30d Mon Sep 17 00:00:00 2001 From: "Tomas \"Jethro\" Pokorny" Date: Wed, 8 Apr 2020 21:45:55 +0200 Subject: [PATCH] Fix obrazek_maly_tag kdyz neni zadny obrazek. --- galerie/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/galerie/models.py b/galerie/models.py index c6acc5df..2d9b8e56 100644 --- a/galerie/models.py +++ b/galerie/models.py @@ -69,6 +69,8 @@ class Obrazek(models.Model): ordering = ['nazev'] def obrazek_maly_tag(self): + if not self.obrazek_maly: + return '' return u''.format(self.obrazek_maly.url) obrazek_maly_tag.short_description = "Náhled" obrazek_maly_tag.allow_tags = True