diff --git a/django/core/validators.py b/django/core/validators.py
index e728dbc..f6204c1 100644
|
a
|
b
|
class IsValidDecimal(object):
|
| 437 | 437 | raise ValidationError, _("Please enter a valid decimal number.") |
| 438 | 438 | |
| 439 | 439 | pieces = str(val).lstrip("-").split('.') |
| | 440 | if pieces[0] == '0' and ((len(pieces) == 2) and len(pieces[1])): |
| | 441 | pieces[0] = '' |
| 440 | 442 | decimals = (len(pieces) == 2) and len(pieces[1]) or 0 |
| 441 | 443 | digits = len(pieces[0]) |
| 442 | 444 | |
diff --git a/tests/modeltests/validation/models.py b/tests/modeltests/validation/models.py
index 63f9f7a..40de933 100644
|
a
|
b
|
u'john@example.com'
|
| 154 | 154 | >>> errors['birthdate'] |
| 155 | 155 | [u'This field is required.'] |
| 156 | 156 | |
| | 157 | >>> from django.core.validators import IsValidDecimal |
| | 158 | >>> valdec = IsValidDecimal(2, 2) |
| | 159 | >>> valdec('.00', []) |
| | 160 | |
| 157 | 161 | """} |