def clean_filename(self):
        if 'submit' in self.data:
            fname = self.cleaned_data.get('filename')
            if not fname or not fname.name.endswith('.csv'):
                raise forms.ValidationError(u'Please upload a .csv file')
            return fname
dataset/ETHPy150Open pinax/symposion/symposion/schedule/forms.py/ScheduleSectionForm.clean_filename/original