Sabtu, 07 April 2012

Django form.fileField validation

I am using a filefield and a text field in my form class SolutionForm(forms.Form): text = forms.CharField(widget=forms.Textarea, required=False) file = forms.FileField(required=False) I have also defined a clean method: def clean(self,*args, **kwargs): if (not self.data['file'] or self.data['text']): raise forms.ValidationError('Please enter your code in text box or

0 comments:

Posting Komentar