|
@@ -3,13 +3,13 @@ from floppyforms import Form as BaseForm, ModelForm as BaseModelForm
|
|
|
|
|
|
|
|
|
|
class AutoStripInputMixin(object):
|
|
class AutoStripInputMixin(object):
|
|
- dont_strip = None
|
|
|
|
|
|
+ autostrip_exclude = None
|
|
|
|
|
|
def full_clean(self):
|
|
def full_clean(self):
|
|
self.data = self.data.copy()
|
|
self.data = self.data.copy()
|
|
for name, field in self.fields.iteritems():
|
|
for name, field in self.fields.iteritems():
|
|
- if (field.__class__ == forms.CharField and
|
|
|
|
- not name in self.dont_strip):
|
|
|
|
|
|
+ if (field.__class__ == CharField and
|
|
|
|
+ not name in self.autostrip_exclude):
|
|
try:
|
|
try:
|
|
self.data[name] = self.data[name].strip()
|
|
self.data[name] = self.data[name].strip()
|
|
except KeyError:
|
|
except KeyError:
|
|
@@ -17,9 +17,9 @@ class AutoStripInputMixin(object):
|
|
return super(AutoStripInputMixin, self).full_clean()
|
|
return super(AutoStripInputMixin, self).full_clean()
|
|
|
|
|
|
|
|
|
|
-class Form(AutoStripInputMixin, forms.BaseForm):
|
|
|
|
|
|
+class Form(AutoStripInputMixin, BaseForm):
|
|
pass
|
|
pass
|
|
|
|
|
|
|
|
|
|
-class ModelForm(AutoStripInputMixin, forms.BaseModelForm):
|
|
|
|
|
|
+class ModelForm(AutoStripInputMixin, BaseModelForm):
|
|
pass
|
|
pass
|