From b724f037f8ff15f182273a42ca733c0c624fbe05 Mon Sep 17 00:00:00 2001 From: Wentao Zhang Date: Fri, 8 Sep 2023 13:49:12 +0800 Subject: [PATCH] Fix the problem that horizon launch fails due to python3-django upgrade https://github.com/django/django/commit/fb4c55d9ec4bb812a7fb91fa20510d91645e411b This commit disables FileInput for uploading multiple files directly and introduces a new method as a replacement. the upgrade of python3-django from 2:2.2.28-1~deb11u1 to 2:2.2.28-1~deb11u2 includes this commit. Refer to the method introduced in the commit to replace the previous usage. Test Plan PASS: build-pkgs -c -p starlingx-dashboard && build-image PASS: jenkins installation successfuly PASS: horizon.service can been successfully loaded and restarted with python3-django 2:2.2.28-1~deb11u2 Closes-Bug: 2030473 Depends-On: https://review.opendev.org/c/starlingx/tools/+/894257 Change-Id: I5e07f3ec7e02090f1a04038c768a7e657131934e Signed-off-by: Wentao Zhang --- .../dashboards/admin/software_management/forms.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/software_management/forms.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/software_management/forms.py index dbbf36fc..eb7d39c8 100644 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/software_management/forms.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/software_management/forms.py @@ -6,6 +6,7 @@ import logging +from django.forms import FileInput from django.urls import reverse # noqa from django.utils.translation import ugettext_lazy as _ @@ -17,10 +18,14 @@ from starlingx_dashboard import api as stx_api LOG = logging.getLogger(__name__) +class MultipleFileInput(FileInput): + allow_multiple_selected = True + + class UploadPatchForm(forms.SelfHandlingForm): failure_url = 'horizon:admin:software_management:index' patch_files = forms.FileField(label=_("Patch File(s)"), - widget=forms.FileInput(attrs={ + widget=MultipleFileInput(attrs={ 'data-source-file': _('Patch File(s)'), 'multiple': "multiple"}), required=True)