Admin: fix odkazu na číslo zadání/řešení
This commit is contained in:
parent
c7a792257f
commit
75794b5e48
1 changed files with 4 additions and 0 deletions
|
@ -495,6 +495,8 @@ class ProblemZadanyAdmin(ProblemAdmin):
|
||||||
]
|
]
|
||||||
|
|
||||||
def cislo_zadani_link(self, obj):
|
def cislo_zadani_link(self, obj):
|
||||||
|
if not obj.cislo_zadani:
|
||||||
|
return ""
|
||||||
return mark_safe('<a href="{}">{}</a>'.format(
|
return mark_safe('<a href="{}">{}</a>'.format(
|
||||||
reverse("admin:seminar_cislo_change", args=(obj.cislo_zadani.pk,)),
|
reverse("admin:seminar_cislo_change", args=(obj.cislo_zadani.pk,)),
|
||||||
obj.cislo_zadani
|
obj.cislo_zadani
|
||||||
|
@ -505,6 +507,8 @@ class ProblemZadanyAdmin(ProblemAdmin):
|
||||||
# nějak zjednodušit, např. tímto?
|
# nějak zjednodušit, např. tímto?
|
||||||
# https://github.com/gitaarik/django-admin-relation-links
|
# https://github.com/gitaarik/django-admin-relation-links
|
||||||
def cislo_reseni_link(self, obj):
|
def cislo_reseni_link(self, obj):
|
||||||
|
if not obj.cislo_reseni:
|
||||||
|
return ""
|
||||||
return mark_safe('<a href="{}">{}</a>'.format(
|
return mark_safe('<a href="{}">{}</a>'.format(
|
||||||
reverse("admin:seminar_cislo_change", args=(obj.cislo_reseni.pk,)),
|
reverse("admin:seminar_cislo_change", args=(obj.cislo_reseni.pk,)),
|
||||||
obj.cislo_reseni
|
obj.cislo_reseni
|
||||||
|
|
Loading…
Reference in a new issue