#24636: InvalidOperation saving decimal.Decimal
-------------------------------------+-------------------------------------
Reporter: glic3rinu | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Normal | Resolution: invalid
Keywords: InvalidOperation | Triage Stage:
decimal Decimal | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by iuliachiriac):
* status: new => closed
* resolution: => invalid
Comment:
This is not actually a bug.
`value=1` with 2 decimals will be saved as `1.00`, meaning it exceeds the
maximum number of digits (you actually have 3 digits). In general, if
`max_digits == decimal_places` you can only save subunitary numbers, with
a precision of `decimal_places` digits.
Similarly, `max_digits=3` and `decimal_places=1` will work for numbers up
to `9.99`, and will fail for `value=11`.
--
Ticket URL: <https://code.djangoproject.com/ticket/24636#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.55b0c22c1cc9f0cf581a85fbc1bbc608%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.