From 8dbc8c2f98196ad820e41b3c4b96102ac8eabff9 Mon Sep 17 00:00:00 2001 From: Ben Silverman Date: Mon, 18 Dec 2023 15:41:25 -0500 Subject: [PATCH] Fix ClearableFileInput (subclass according to django docs) --- apps/ingest/forms.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/ingest/forms.py b/apps/ingest/forms.py index a4f57fcb..a4cc6686 100644 --- a/apps/ingest/forms.py +++ b/apps/ingest/forms.py @@ -2,10 +2,15 @@ from django.forms import ClearableFileInput from .models import Bulk + +class MultipleFileInput(forms.ClearableFileInput): + allow_multiple_selected = True + + class BulkVolumeUploadForm(forms.ModelForm): class Meta: model = Bulk - fields = ['image_server', 'volume_files', 'collections'] + fields = ["image_server", "volume_files", "collections"] widgets = { - 'volume_files': ClearableFileInput(attrs={'allow_multiple_selected': True, 'multiple': True}), + "volume_files": MultipleFileInput, }