Added rounding for unicode return value of to_mongo in DecimalField. Closes #1103

This commit is contained in:
Дмитрий Янцен 2016-12-06 10:42:10 +05:00
parent 25e0f12976
commit 7ce8768c19
3 changed files with 3 additions and 1 deletions

View File

@ -242,3 +242,4 @@ that much better:
* xiaost7 (https://github.com/xiaost7)
* Victor Varvaryuk
* Stanislav Kaledin (https://github.com/sallyruthstruik)
* Dmitry Yantsen (https://github.com/mrTable)

View File

@ -7,6 +7,7 @@ Changes in 0.10.8
- Added ability to specify an authentication mechanism (e.g. X.509) #1333
- Added support for falsey primary keys (e.g. doc.pk = 0) #1354
- Fixed BaseQuerySet#sum/average for fields w/ explicit db_field #1417
- Fixed absent rounding for DecimalField when `force_string` is set. #1103
Changes in 0.10.7
=================

View File

@ -341,7 +341,7 @@ class DecimalField(BaseField):
if value is None:
return value
if self.force_string:
return unicode(value)
return unicode(self.to_python(value))
return float(self.to_python(value))
def validate(self, value):