Fixed DecimalField arbitrary precision support by dvarrazzo · Pull Request #4075 · encode/django-rest-framework (original) (raw)
New issue
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation3 Commits1 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
DecimalField
has some support for non strict number of decimal places (checking here and there that decimal_places
is not None but it fails in quantize()
with "unsupported operand type(s) for ** or pow(): 'Decimal' and 'NoneType'".
This changeset fixes the problem and allows DecimalField
to handle decimal_places=None
. Tests added too.
jpadilla added this to the 3.3.4 Release milestone
@dvarrazzo good stuff, thanks! Anyone else has any objections/comments?
@dvarrazzo @jpadilla @tomchristie is decimal_places=None
allowed then? We should update the docs to make that clear (I volunteer to do so).
On the other hand, why are args decimal_places
and max_digits
required then? As mentioned by @xordoquy here, those that are not kwargs to __init__
are supposed to be required (because they can not be set to a default value).
This was referenced
Mar 9, 2017