From 75794b5e48735ee16616dde5c5bbf5e122d4308c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Fri, 21 Apr 2017 22:56:46 +0200 Subject: [PATCH] =?UTF-8?q?Admin:=20fix=20odkazu=20na=20=C4=8D=C3=ADslo=20?= =?UTF-8?q?zad=C3=A1n=C3=AD/=C5=99e=C5=A1en=C3=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/admin.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/seminar/admin.py b/seminar/admin.py index cdb9f3fc..1532b54d 100644 --- a/seminar/admin.py +++ b/seminar/admin.py @@ -495,6 +495,8 @@ class ProblemZadanyAdmin(ProblemAdmin): ] def cislo_zadani_link(self, obj): + if not obj.cislo_zadani: + return "" return mark_safe('{}'.format( reverse("admin:seminar_cislo_change", args=(obj.cislo_zadani.pk,)), obj.cislo_zadani @@ -505,6 +507,8 @@ class ProblemZadanyAdmin(ProblemAdmin): # nějak zjednodušit, např. tímto? # https://github.com/gitaarik/django-admin-relation-links def cislo_reseni_link(self, obj): + if not obj.cislo_reseni: + return "" return mark_safe('{}'.format( reverse("admin:seminar_cislo_change", args=(obj.cislo_reseni.pk,)), obj.cislo_reseni