Edge case DecimalField serialization #9135
Unanswered
szymonhab
asked this question in
Potential Issue
Replies: 1 comment 1 reply
-
Facing same issue |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey, i've noticed a strange behavior in Decimal serialization
In theory i shouldn't expect any error here. Especially that this code fired after running for few months on production - only when serialized value is greater or equal to 1.0
Same bug occurs for
serializers.DecimalField(decimal_places=3, max_digits=4)
configuration - when value is greater or equal to 10In theory this isn't a problem when someone serializes verified data from psql, this time I serialize raw python objects to json payload and decimals should be rounded up somehow?
Possible solution could be to just cut decimal part that can't fit into the configured places
Beta Was this translation helpful? Give feedback.
All reactions