Guest User

Untitled

a guest
Jul 17th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. def validate_file_extension(value):
  2. if not value.name.endswith('.pdf'):
  3. raise ValidationError(u'Error message')
  4.  
  5. actual_file = models.FileField(upload_to='uploaded_files', validators=[validate_file_extension])
Add Comment
Please, Sign In to add comment