Save py2.6 from Decimal Float fun
This commit is contained in:
parent
5e94637adc
commit
13d8dfdb5f
1 changed files with 3 additions and 2 deletions
|
|
@ -297,8 +297,9 @@ class DecimalField(BaseField):
|
|||
if value is None:
|
||||
return value
|
||||
|
||||
return decimal.Decimal(value).quantize(self.precision,
|
||||
rounding=self.rounding)
|
||||
# Convert to string for python 2.6 before casting to Decimal
|
||||
value = decimal.Decimal("%s" % value)
|
||||
return value.quantize(self.precision, rounding=self.rounding)
|
||||
|
||||
def to_mongo(self, value):
|
||||
if value is None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue