#18509 closed Bug (wontfix)
Bug: forms.DecimalField doesn't validate correctly when localized. (Unittest attached)
Reported by: | Serge Spaolonzi | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | 1.4 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Design decision needed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
forms.DecimalField doesn't validate correctly when localized.
A form DecimalField is expected to validate invalid values when the method to python is called.
It throws a ValidationError for non localized instances when an incorrect value is introduced.
But for localized instances that are expected to accept a comma (,) as decimal separator it doesn't throw any exception for a value with a dot (.) and take it as valid.
Unittest attached
Attachments (1)
Change History (5)
by , 12 years ago
comment:1 by , 12 years ago
Summary: | Bug: forms.DecimalField doesn't validate correctly when localized. (Unittest) → Bug: forms.DecimalField doesn't validate correctly when localized. (Unittest attached) |
---|
comment:2 by , 12 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:3 by , 12 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
I do agree with Aymeric. Unless we miss a problematic use case, I don't think this is an issue. Reopen if you can show us that this can cause bugs.
comment:4 by , 11 years ago
Quite neat IMHO, although for Django >= 1.6 only:
https://docs.djangoproject.com/en/1.6/topics/forms/modelforms/#enabling-localization-of-fields
+
https://docs.djangoproject.com/en/1.6/ref/contrib/admin/#django.contrib.admin.ModelAdmin.form
The input isn't ambiguous: both
"123.45"
and"123,45"
represent `Decimal("123.45").I don't see much value in rejecting the first form, especially Django historically accepts it. I would go as far as to say it isn't worth the backwards incompatibility.