diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-09-15 11:45:19 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-09-15 11:45:19 +0000 |
| commit | 885db3cb793ac1a7c269a67b5739dfc4dbe6214d (patch) | |
| tree | d9eee121e9b5f63153cb570c7bd14746c360d449 /django/newforms | |
| parent | 7ca1a04633a7516df3610ff97a83d8850219622d (diff) | |
Fixed #5355 -- Fixed data cleaning for DecimalField.
In passing, fixed a problem with cleaning in IntegerField.
Includes tests from PhiR.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6282 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/newforms')
| -rw-r--r-- | django/newforms/fields.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/newforms/fields.py b/django/newforms/fields.py index d83cb6cde2..2e0cfb3f92 100644 --- a/django/newforms/fields.py +++ b/django/newforms/fields.py @@ -144,7 +144,7 @@ class IntegerField(Field): if value in EMPTY_VALUES: return None try: - value = int(value) + value = int(str(value)) except (ValueError, TypeError): raise ValidationError(ugettext(u'Enter a whole number.')) if self.max_value is not None and value > self.max_value: @@ -192,7 +192,7 @@ class DecimalField(Field): super(DecimalField, self).clean(value) if not self.required and value in EMPTY_VALUES: return None - value = value.strip() + value = str(value).strip() try: value = Decimal(value) except DecimalException: |
