diff --git a/django/forms/fields.py b/django/forms/fields.py
index 03455e0..51551de 100644
a
|
b
|
class EmailField(CharField):
|
448 | 448 | } |
449 | 449 | default_validators = [validators.validate_email] |
450 | 450 | |
| 451 | def clean(self, value): |
| 452 | value = self.to_python(value).strip() |
| 453 | return super(EmailField, self).clean(value) |
| 454 | |
451 | 455 | class FileField(Field): |
452 | 456 | widget = ClearableFileInput |
453 | 457 | default_error_messages = { |
diff --git a/tests/regressiontests/forms/fields.py b/tests/regressiontests/forms/fields.py
index d29e2e8..cf0c3f6 100644
a
|
b
|
class FieldsTests(TestCase):
|
430 | 430 | self.assertEqual(u'', f.clean('')) |
431 | 431 | self.assertEqual(u'', f.clean(None)) |
432 | 432 | self.assertEqual(u'person@example.com', f.clean('person@example.com')) |
| 433 | self.assertEqual(u'example@example.com', f.clean(' example@example.com \t \t ')) |
433 | 434 | self.assertRaisesErrorWithMessage(ValidationError, "[u'Enter a valid e-mail address.']", f.clean, 'foo') |
434 | 435 | self.assertRaisesErrorWithMessage(ValidationError, "[u'Enter a valid e-mail address.']", f.clean, 'foo@') |
435 | 436 | self.assertRaisesErrorWithMessage(ValidationError, "[u'Enter a valid e-mail address.']", f.clean, 'foo@bar') |