From c09aeddad7d79c33887639fa026c9294d4b6149e Mon Sep 17 00:00:00 2001 From: eduardo-devintage <63951752+eduardo-devintage@users.noreply.github.com> Date: Tue, 30 Apr 2024 12:13:46 +0200 Subject: [PATCH] Update photos.py --- apps/core/forms/photos.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/core/forms/photos.py b/apps/core/forms/photos.py index 679268d9..883f3a2e 100644 --- a/apps/core/forms/photos.py +++ b/apps/core/forms/photos.py @@ -9,8 +9,12 @@ from apps.core.models.photos import PhotoAlbum, PhotoObject +class MultipleFileInput(forms.ClearableFileInput): + allow_multiple_selected = True + + class PhotoAlbumForm(forms.ModelForm): - photos = forms.ImageField(widget=forms.ClearableFileInput(attrs={"allow_multiple_selected": True}), required=False) + photos = forms.ImageField(widget=MultipleFileInput(), required=False) class Meta: model = PhotoAlbum @@ -53,7 +57,7 @@ def __init__(self, *args, **kwargs): class PhotoObjectForm(forms.ModelForm): - photo = forms.ImageField(widget=forms.ClearableFileInput(attrs={"allow_multiple_selected": True}), required=True) + photo = forms.ImageField(widget=MultipleFileInput(), required=True) class Meta: model = PhotoObject