def clean_syllabus_file(self): """Check if uploaded syllabus file is of an acceptable format.""" syllabus_file = self.cleaned_data.get('syllabus_file') if get_file_mimetype(syllabus_file) != 'application/pdf': raise forms.ValidationError('Uploaded file must be a PDF file.') return syllabus_file
def clean_resume_file(self): """Check if uploaded file is of an acceptable format.""" resume_file = self.cleaned_data.get('resume_file') if get_file_mimetype(resume_file) != 'application/pdf': raise forms.ValidationError('Uploaded file must be a PDF file.') return resume_file
def clean_notes(self): """Check that the uploaded file is a text file.""" notes = self.cleaned_data['notes'] if get_file_mimetype(notes) != 'text/plain': raise forms.ValidationError('Uploaded file must be a text file.') return notes