Opened 12 years ago

Closed 11 years ago

Last modified 10 years ago

#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)

tests.py (802 bytes ) - added by Serge Spaolonzi 12 years ago.

Download all attachments as: .zip

Change History (5)

by Serge Spaolonzi, 12 years ago

Attachment: tests.py added

comment:1 by Serge Spaolonzi, 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 Aymeric Augustin, 12 years ago

Triage Stage: UnreviewedDesign decision needed

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 when Django historically accepts it. I would go as far as to say it isn't worth the backwards incompatibility.

Last edited 12 years ago by Aymeric Augustin (previous) (diff)

comment:3 by Claude Paroz, 11 years ago

Resolution: wontfix
Status: newclosed

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.

Note: See TracTickets for help on using tickets.
Back to Top