getting the sum of prices for each user

I have a table that has fields of user and prices. I want to display total price of each user by itself just like the photo shows 2 users ahmad and taleen so i need to show ahmad records then the total is 5 for ahmad then taleen records then the total is 5 for taleen.

here is the code:

def prayer_reports(request):
	prices = []
	records = Prayer.objects.all().order_by('user')

	for i in records:

	total_price = sum(prices)

	return render(request, 'prayers/prayer_reports.html',{'records':records,'total_price':total_price})

class Prayer(models.Model):
	user = models.CharField(max_length=50, null=True, default="User")
	name = models.CharField(max_length=50, null=True,default="Prayer")
	time_entered= models.TimeField("%H:%M"))
	on_time = models.BooleanField(default=True)
	price = models.FloatField(default=0.0)

	def __str__(self):


{% extends 'docs/main.html' %}
{% block content %}

{% if user.is_superuser %}
	{% for i in records %}
		<h3>Name: {{i.user}}</h3>
		<h3>Prayer: {{}}</h3>
		<h3>Date: {{}}</h3>
		<h3>Price: {{i.price}}</h3>
	{% endfor %}
{% endif %}

{% endblock content %}

how can i have this working?

Hey there!
Take a look into annotate/aggregate on the docs.

In your case, you probably will want to use annotate.