Ticket #7064: fix-decimal-validation.diff

File fix-decimal-validation.diff, 547 bytes (added by Craig Ogg, 16 years ago)

Corrected patch

  • django/core/validators.py

     
    437437            raise ValidationError, _("Please enter a valid decimal number.")
    438438
    439439        pieces = str(val).lstrip("-").split('.')
     440        if pieces[0] == '0' and ((len(pieces) == 2) and len(pieces[1])):
     441            pieces[0] = ''
    440442        decimals = (len(pieces) == 2) and len(pieces[1]) or 0
    441443        digits = len(pieces[0])
    442444
Back to Top