From 305fb669bdcfd9889af51f703d5884d39c229ac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Besson?= Date: Thu, 4 May 2023 12:17:40 +0100 Subject: [PATCH 1/2] Bind uploaded files to the FilesAnnotationForm Presently, files uploaded in the UI are not bound to the form and thus the is_valid() check is largely a no-op. As per the default validation contract of FileField, this means that this UI can create annotations with empty files. See https://docs.djangoproject.com/en/3.2/ref/forms/api/#binding-uploaded-files --- omeroweb/webclient/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/omeroweb/webclient/views.py b/omeroweb/webclient/views.py index 8a0b3cb567..82da8ce467 100755 --- a/omeroweb/webclient/views.py +++ b/omeroweb/webclient/views.py @@ -2399,7 +2399,9 @@ def annotate_file(request, conn=None, **kwargs): if request.method == "POST": # handle form submission - form_file = FilesAnnotationForm(initial=initial, data=request.POST.copy()) + form_file = FilesAnnotationForm( + initial=initial, data=request.POST.copy(), files=request.FILES + ) if form_file.is_valid(): # Link existing files... files = form_file.cleaned_data["files"] From 3bda370963e6560111dc04c857ce34dc69d02eb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Besson?= Date: Thu, 4 May 2023 14:11:12 +0100 Subject: [PATCH 2/2] Temporarily cap Django to 3.2.18 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b119f6c9a6..c9876c9447 100755 --- a/setup.py +++ b/setup.py @@ -54,7 +54,7 @@ def read(fname): "omero-py>=5.7.0", # minimum requirements for `omero web start` "concurrent-log-handler>=0.9.20", - "Django>=3.2.18,<4.0", + "Django==3.2.18,<4.0", "django-pipeline==2.0.7", "django-cors-headers==3.7.0", "whitenoise>=5.3.0",