I am looking to throw a validation error if the user tries to upload more than 1 video file (they are allowed to upload more than 1 image).
Here is the code for the field:
media = forms.FileField(
widget=forms.ClearableFileInput(attrs={"multiple": True}),
label="Add image/video",
required=False,
validators=[validate_file_size, validate_file_extension],
)
I am able to go through each file one by one using a validator on the field (checking the file extension of each file), or by using the clean function.