I am trying to calculate the total amount of a sale before saving it in the Django admin site.
Sales data model
Inventory data model
The SaleItem is a through table to keep track of the quantity of each item sold in the sale. How do I calculate the total price of each item sold?
enter image description here
I’ve tried declaring a method called save to calculate the price of the items sold when saving the entry in the django admin, however im getting errors for trying to perform an operation on deferred attribute.
Darwis Lau is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.