1
0
mirror of https://github.com/django/django.git synced 2025-10-27 07:36:08 +00:00

Fixed #5232 -- Fixed the validation of DecimalField so that the negative sign is not counted as a digit. Thanks, Andrew Durdin.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6067 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Gary Wilson Jr
2007-09-08 19:24:46 +00:00
parent ef088d5f36
commit 7e57576ff7
3 changed files with 27 additions and 2 deletions

View File

@@ -190,7 +190,7 @@ class DecimalField(Field):
value = Decimal(value)
except DecimalException:
raise ValidationError(ugettext('Enter a number.'))
pieces = str(value).split('.')
pieces = str(value).lstrip("-").split('.')
decimals = (len(pieces) == 2) and len(pieces[1]) or 0
digits = len(pieces[0])
if self.max_value is not None and value > self.max_value: