Reputation: 6865
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
Upvotes: 1
Views: 528
Reputation: 40052
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
Upvotes: 1