コード例 #1
0
ファイル: forms.py プロジェクト: ochan1/quark
 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
コード例 #2
0
ファイル: forms.py プロジェクト: sjdemartini/quark
 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
コード例 #3
0
ファイル: forms.py プロジェクト: nbailey/quark
 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
コード例 #4
0
ファイル: forms.py プロジェクト: ochan1/quark
 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