Validate Multiple files in django
问题 I want to allow some certain file types to be uploaded. I wrote the below code for one certain file, it worked. def validate_file_extension(value): if not value.name.endswith('.zip'): raise ValidationError(u'Error message') but I want to allow more than one files, so I set those files in settings_dev, and wrote the below code, but not working. def validate_file_extension(value): for f in settings_dev.TASK_UPLOAD_FILE_TYPES: if not value.name.endswith(f): raise ValidationError(u'Error message'