summaryrefslogtreecommitdiff
path: root/django/forms/fields.py
diff options
context:
space:
mode:
authorKaren Tracey <kmtracey@gmail.com>2008-11-10 19:52:53 +0000
committerKaren Tracey <kmtracey@gmail.com>2008-11-10 19:52:53 +0000
commitd82aaef8446c4188a27ba4347b75f0dffaa42f0a (patch)
tree1a347c0fcf83f95b4dfe2bbcf82fa7ac83c87dc1 /django/forms/fields.py
parent8cdc53a265cfbf72ae87aa607a95f4a7eb9a3ac3 (diff)
Fixed #7064: Made DemicmalField validation support max_digits equal to decimal_places.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9387 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: