1 2 3 4 5 6 7 8 9 | from django import forms
def stripclean(self, value):
if isinstance(value, basestring):
value = value.strip()
return oldclean(self, value)
oldclean = forms.fields.CharField.clean
forms.fields.CharField.clean = stripclean
|
More like this
- RedirectedURLField by stringify 3 years, 3 months ago
- CleanCharField by DvD 5 years, 7 months ago
- RangeField and RangeWidget by marinho 4 years, 7 months ago
- FixedCharField and related by andresj 4 years, 6 months ago
- Automatic stripping textual form fields by nail.xx 4 years, 9 months ago
Comments