Skip to content

Commit

Permalink
Fixed #2760 -- Fixed FloatField validator right (take two!) for negative
Browse files Browse the repository at this point in the history
float amounts.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3845 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
malcolmt committed Sep 26, 2006
1 parent 8350140 commit 1fc62f0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion django/core/validators.py
Expand Up @@ -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:
Expand Down

0 comments on commit 1fc62f0

Please sign in to comment.