summaryrefslogtreecommitdiff
path: root/django/newforms
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-01-13 05:08:07 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-01-13 05:08:07 +0000
commit6b31f95516e3a65f93a9ab6491c6e3b2b54ae620 (patch)
tree5f61504c4947c02db5ebe033aebb5c0ae7de84c7 /django/newforms
parenta0137c41f3b9b95d48f42ddd0fb48703a88a8c94 (diff)
Fixed #3293 -- newforms: Changed IntegerField.clean() to return None if field is not required and empty. Thanks, Honza Kral
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4312 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/newforms')
-rw-r--r--django/newforms/fields.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/newforms/fields.py b/django/newforms/fields.py
index e3c1cee87a..0b883bfad1 100644
--- a/django/newforms/fields.py
+++ b/django/newforms/fields.py
@@ -114,11 +114,11 @@ class IntegerField(Field):
def clean(self, value):
"""
Validates that int() can be called on the input. Returns the result
- of int().
+ of int(). Returns None for empty values.
"""
super(IntegerField, self).clean(value)
if not self.required and value in EMPTY_VALUES:
- return u''
+ return None
try:
value = int(value)
except (ValueError, TypeError):