This is how I get average marks of a bunch of schools
def get_clu_average(self):
clu_strength = 0
clu_total = 0
for school in self.school_set.all():
clu_strength = clu_strength + school.strength
clu_total = clu_total + school.get_average() * school.strength
return clu_total / clu_strength
So the value will be a decimal number. When I directly use that in template I am getting a lot of decimal places. How do I restrict the value to only 2 decimal places?