You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import mongoengine as me
class Orders(me.Document):
order_id = me.SequenceField(primary_key=True)
total_due_amount = me.DecimalField(required=True)
# other irrevelant fields
I have views like
def update_total_due_amount(request):
# some irrelevant pre processing
total_amount_paid = 10 # after some preprocessing assume total_amount_paid is 10
order_obj_update = Orders.objects(order_id=order_id).update_one(dec__total_due_amount=total_amount_paid) # this raises an exception
The actual exception is Cannot encode object: Decimal('-10.00')
I have worked around by
Orders.objects(order_id=order_id).update_one(dec__total_due_amount=int(total_amount_paid)) # observe the int()
Is this how it should have been done ? Or am I missing something ?
The text was updated successfully, but these errors were encountered:
I have models like
I have views like
The actual exception is Cannot encode object: Decimal('-10.00')
I have worked around by
Orders.objects(order_id=order_id).update_one(dec__total_due_amount=int(total_amount_paid)) # observe the int()
Is this how it should have been done ? Or am I missing something ?
The text was updated successfully, but these errors were encountered: