11👍
✅
from decimal import Decimal
object.fieldName = Decimal("0.85")
or
f = 0.85
object.fieldName = Decimal(str(f))
👤Greg
3👍
The Django DecimalField is “…represented in by a python Decimal instance.” You might try:
>>> obj.fieldName = Decimal("0.85")
Behavior may also vary depending on the database backend you are using. With sqlite, I am able to assign string values to DecimalFields in new and existing objects without error.
Source:stackexchange.com