Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
  • Loading branch information...
commit 1fc62f0fd6499605340d8608b7f0ae59bb88245d 1 parent 8350140
@malcolmt malcolmt authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  django/core/validators.py
View
2  django/core/validators.py
@@ -377,7 +377,7 @@ def __call__(self, field_data, all_data):
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:
Please sign in to comment.
Something went wrong with that request. Please try again.