I’m trying to upload videos from django admin, but I can’t see how to validate that the user is upload only video files, and no other file types.
Any idea?
Thanks
Sorry with my English
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The right way to do this is to create a custom ModelForm for your admin class, and write a
clean_[video_field_name]method that validates the file and throws a ValidationError if it’s not of the correct type.The docs for doing this are here: Adding custom validation to the admin