Update file forms.py
This commit is contained in:
parent
88fd7a1ec0
commit
43168e253a
1 changed files with 2 additions and 3 deletions
|
|
@ -16,8 +16,9 @@ from .models import Gallery, Tag
|
||||||
class MultipleFileInput(forms.ClearableFileInput):
|
class MultipleFileInput(forms.ClearableFileInput):
|
||||||
allow_multiple_selected = True
|
allow_multiple_selected = True
|
||||||
|
|
||||||
|
|
||||||
class MultipleFileField(forms.FileField):
|
class MultipleFileField(forms.FileField):
|
||||||
allowed_extensions = ['jpg', 'jpeg', 'png','gif', 'tiff'] # Specify allowed extensions here
|
allowed_extensions = ['jpg', 'jpeg', 'png', 'gif', 'tiff'] # Specify allowed extensions here
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
kwargs.setdefault(
|
kwargs.setdefault(
|
||||||
|
|
@ -53,8 +54,6 @@ class MultipleFileField(forms.FileField):
|
||||||
)
|
)
|
||||||
return cleaned_file
|
return cleaned_file
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class UploadForm(forms.Form):
|
class UploadForm(forms.Form):
|
||||||
file_field = MultipleFileField(label="")
|
file_field = MultipleFileField(label="")
|
||||||
gallery = forms.ModelChoiceField(
|
gallery = forms.ModelChoiceField(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue