From: Radek Czajka Date: Tue, 12 Oct 2021 13:38:31 +0000 (+0200) Subject: pz admin fix X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/d96e1d2348113e3fc0c7961d83d278933d090a6d?ds=inline pz admin fix --- diff --git a/src/pz/admin.py b/src/pz/admin.py index 6c51aefaa..25c700b95 100644 --- a/src/pz/admin.py +++ b/src/pz/admin.py @@ -130,9 +130,12 @@ class BankOrderAdmin(admin.ModelAdmin): return fields def download(self, obj): - return mark_safe('Download'.format( - reverse('admin:pz_bankorder_download', args=[obj.pk]) - )) + if obj is not None and obj.pk: + return mark_safe('Download'.format( + reverse('admin:pz_bankorder_download', args=[obj.pk]) + )) + else: + return '' def get_urls(self): urls = super().get_urls()