From 58dd9a71d75483300bee180f343ba3caf1b0baba Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Tue, 5 Nov 2024 11:23:07 +0100 Subject: [PATCH] Don't crash when both removing and uploading PDF at the same time Noted by Karen Jex --- postgresqleu/util/widgets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgresqleu/util/widgets.py b/postgresqleu/util/widgets.py index 9af60ebc..4fbc637a 100644 --- a/postgresqleu/util/widgets.py +++ b/postgresqleu/util/widgets.py @@ -102,7 +102,7 @@ class InlinePdfUploadWidget(forms.ClearableFileInput): def render(self, name, value, attrs=None, renderer=None): context = self.get_context(name, value, attrs) - if value and not isinstance(value, UploadedFile): + if value and not isinstance(value, UploadedFile) and type(value) != object: context['widget']['value'] = base64.b64encode(value).decode('ascii') return mark_safe(loader.render_to_string('confreg/widgets/inline_pdf_upload_widget.html', context)) -- 2.39.5