Sum function in django

I’m new to django and have being trying my hands on a few stuffs. Currently building a small accounting app with django.
I will like to know what view function can be used to sum up the values in the row and store in a column as total_price. I will prefer the total_price returned as an integer not a dic