Merge branch 'patch-1' of https://github.com/oleksandr-l5/mongoengine
This commit is contained in:
commit
f6d864b6d1
@ -482,10 +482,11 @@ class DecimalField(BaseField):
|
||||
value = decimal.Decimal("%s" % value)
|
||||
except (TypeError, ValueError, decimal.InvalidOperation):
|
||||
return value
|
||||
return value.quantize(
|
||||
decimal.Decimal(".%s" % ("0" * self.precision)), rounding=self.rounding
|
||||
)
|
||||
|
||||
if self.precision > 0:
|
||||
return value.quantize(decimal.Decimal(".%s" % ("0" * self.precision)), rounding=self.rounding)
|
||||
else:
|
||||
return value.quantize(decimal.Decimal(), rounding=self.rounding)
|
||||
|
||||
def to_mongo(self, value):
|
||||
if value is None:
|
||||
return value
|
||||
|
Loading…
x
Reference in New Issue
Block a user