This commit is contained in:
Yohan Graterol 2014-11-07 10:55:46 -05:00
commit 897480265f
2 changed files with 3 additions and 2 deletions

View File

@ -6,6 +6,7 @@ Changelog
Changes in 0.9.X - DEV
======================
- with_limit_and_skip for count should default like in pymongo #759
- Fix storing value of precision attribute in DecimalField #787
- Querying by a field defined in a subclass raises InvalidQueryError #744
- Add Support For MongoDB 2.6.X's maxTimeMS #778
- abstract shouldn't be inherited in EmbeddedDocument # 789

View File

@ -308,7 +308,7 @@ class DecimalField(BaseField):
self.min_value = min_value
self.max_value = max_value
self.force_string = force_string
self.precision = decimal.Decimal(".%s" % ("0" * precision))
self.precision = precision
self.rounding = rounding
super(DecimalField, self).__init__(**kwargs)
@ -322,7 +322,7 @@ class DecimalField(BaseField):
value = decimal.Decimal("%s" % value)
except decimal.InvalidOperation:
return value
return value.quantize(self.precision, rounding=self.rounding)
return value.quantize(decimal.Decimal(".%s" % ("0" * self.precision)), rounding=self.rounding)
def to_mongo(self, value, use_db_field=True):
if value is None: