summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2006-09-26 01:57:26 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2006-09-26 01:57:26 +0000
commit1fc62f0fd6499605340d8608b7f0ae59bb88245d (patch)
treed656c69018a1d2e7c70211bb71a95e07f972429b
parent83501405c25b85abde529fa7e205a00100211e5c (diff)
Fixed #2760 -- Fixed FloatField validator right (take two!) for negative
float amounts. git-svn-id: http://code.djangoproject.com/svn/django/trunk@3845 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/core/validators.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/core/validators.py b/django/core/validators.py
index af1254c438..4c3f59143e 100644
--- a/django/core/validators.py
+++ b/django/core/validators.py
@@ -377,7 +377,7 @@ class IsValidFloat(object):
if len(data) > max_allowed_length:
raise ValidationError, ngettext("Please enter a valid decimal number with at most %s total digit.",
"Please enter a valid decimal number with at most %s total digits.", self.max_digits) % self.max_digits
- if (not '.' in data and len(data) > (max_allowed_length - self.decimal_places)) or ('.' in data and len(data) > (self.max_digits - (self.decimal_places - len(data.split('.')[1])) + 1)):
+ if (not '.' in data and len(data) > (max_allowed_length - self.decimal_places - 1)) or ('.' in data and len(data) > (max_allowed_length - (self.decimal_places - len(data.split('.')[1])))):
raise ValidationError, ngettext( "Please enter a valid decimal number with a whole part of at most %s digit.",
"Please enter a valid decimal number with a whole part of at most %s digits.", str(self.max_digits-self.decimal_places)) % str(self.max_digits-self.decimal_places)
if '.' in data and len(data.split('.')[1]) > self.decimal_places: