diff --git a/django/forms/fields.py b/django/forms/fields.py
index 57d6a75..cdbe679 100644
a
|
b
|
class Field(six.with_metaclass(RenameFieldMethods, object)):
|
210 | 210 | |
211 | 211 | |
212 | 212 | class CharField(Field): |
213 | | def __init__(self, max_length=None, min_length=None, *args, **kwargs): |
214 | | self.max_length, self.min_length = max_length, min_length |
| 213 | def __init__(self, max_length=None, min_length=None, strip=False, *args, **kwargs): |
| 214 | self.max_length, self.min_length, self.strip = max_length, min_length, strip |
215 | 215 | super(CharField, self).__init__(*args, **kwargs) |
216 | 216 | if min_length is not None: |
217 | 217 | self.validators.append(validators.MinLengthValidator(int(min_length))) |
… |
… |
class CharField(Field):
|
231 | 231 | attrs.update({'maxlength': str(self.max_length)}) |
232 | 232 | return attrs |
233 | 233 | |
| 234 | def clean(self, value): |
| 235 | if self.strip and isinstance(value, six.text_type): |
| 236 | value = self.to_python(value) |
| 237 | value = value.strip() |
| 238 | return super(CharField, self).clean(value) |
| 239 | |
234 | 240 | |
235 | 241 | class IntegerField(Field): |
236 | 242 | widget = NumberInput |