Dec-19-2021, 05:33 AM
Hi
I have a problem with total that is float and i have tried to make it 2 decimal but sometimes it is working and sometimes it is not working.
I have a problem with total that is float and i have tried to make it 2 decimal but sometimes it is working and sometimes it is not working.
@property
def get_cart_total(self):
orderitems = self.orderitem_set.all()
total = sum([item.get_total for item in orderitems])
formatted_float = "{:.2f}".format(total)
total = float(formatted_float)
return totalThanks.
