From d96e1d2348113e3fc0c7961d83d278933d090a6d Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 12 Oct 2021 15:38:31 +0200 Subject: [PATCH] pz admin fix --- src/pz/admin.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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() -- 2.20.1