Ticket #1088: isValidFloat.diff
File isValidFloat.diff, 1.3 KB (added by , 19 years ago) |
---|
-
core/validators.py
350 350 if len(data) > (self.max_digits + 1): 351 351 raise ValidationError, ngettext( "Please enter a valid decimal number with at most %s total digit.", 352 352 "Please enter a valid decimal number with at most %s total digits.", self.max_digits) % self.max_digits 353 if (not '.' in data and len(data) > (self.max_digits - self.decimal_places)) \ 354 or ('.' in data and len(data) > (self.max_digits - (self.decimal_places - len(data.split('.')[1])) + 1)): 355 raise ValidationError, ngettext( "Please enter a valid decimal number with a whole part of at most %s digit.", 356 "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) 353 357 if '.' in data and len(data.split('.')[1]) > self.decimal_places: 354 358 raise ValidationError, ngettext("Please enter a valid decimal number with at most %s decimal place.", 355 359 "Please enter a valid decimal number with at most %s decimal places.", self.decimal_places) % self.decimal_places