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