mirror of
https://github.com/django/django.git
synced 2025-10-25 06:36:07 +00:00
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
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user