Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def validate_file_extension(value):
- if not value.name.endswith('.pdf'):
- raise ValidationError(u'Error message')
- actual_file = models.FileField(upload_to='uploaded_files', validators=[validate_file_extension])
Add Comment
Please, Sign In to add comment