Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
to your account
We got an issue when number is formatted as decimal.Decimal('2E+9').
How DecimalField counts decimals:
sign, digittuple, exponent = value.as_tuple()
decimals = abs(exponent)
However result of decimal.Decimal('2E+9').as_tuple() is 9, which is ok, but there are no decimal places in this number.
My solution is to not do abs and instead multiply by -1.
I can prepare PR tonight if you think it is valid.
The text was updated successfully, but these errors were encountered:
So things that would help here:
Sorry, something went wrong.
@tomchristie I added PR with example and solution.
Basically we get really huge number, then normalize it with .normalize() which resulted in having 2E+9 which resulted in ValidationError :)
Hope PR is valid!
Successfully merging a pull request may close this issue.