[Answer]-Django correct operators for running total

1👍

def estimated_cost(self):
    return (int(len(self.content)) / 160) + (1 * int(self.group.contact_set.count()))

batches = Batch.objects.for_user_pending(request.user)
total_estimated_cost = 0
for item in batches:
    total_estimated_cost += item.estimated_cost()

Leave a comment