Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CommentForm(forms.ModelForm):
- class Meta:
- model = Comment
- fields = ('text',)
- text = forms.CharField(widget=forms.Textarea)
- def clean(self):
- text = self.cleaned_data['text']
- if len(text) < 5:
- raise forms.ValidationError('No, sorry')
- else:
- return self.cleaned_data
Add Comment
Please, Sign In to add comment