summaryrefslogtreecommitdiff
path: root/django/forms/fields.py
diff options
context:
space:
mode:
authorKaren Tracey <kmtracey@gmail.com>2008-11-10 20:04:42 +0000
committerKaren Tracey <kmtracey@gmail.com>2008-11-10 20:04:42 +0000
commit21e0efcd64b7aa0ffdbb7254574644af6d7b7727 (patch)
tree5ea8c391d7889b6b479841620998a962b8439043 /django/forms/fields.py
parent8c31bb7ca366b6daf393e7f1b4d695837c7f5795 (diff)
[1.0.X] Fixed #7064: Made DemicmalField validation support max_digits equal to decimal_places.
r9387 and r9388 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@9389 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/forms/fields.py')
-rw-r--r--django/forms/fields.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/django/forms/fields.py b/django/forms/fields.py
index 836cd5d33c..ccb54d8b32 100644
--- a/django/forms/fields.py
+++ b/django/forms/fields.py
@@ -254,12 +254,12 @@ class DecimalField(Field):
decimals = abs(exponent)
# digittuple doesn't include any leading zeros.
digits = len(digittuple)
- if decimals >= digits:
+ if decimals > digits:
# We have leading zeros up to or past the decimal point. Count
- # everything past the decimal point as a digit. We also add one
- # for leading zeros before the decimal point (any number of leading
- # whole zeros collapse to one digit).
- digits = decimals + 1
+ # everything past the decimal point as a digit. We do not count
+ # 0 before the decimal point as a digit since that would mean
+ # we would not allow max_digits = decimal_places.
+ digits = decimals
whole_digits = digits - decimals
if self.max_value is not None and value > self.max_value: