From 2899c684ac657ee9752cdfbd2e88053748750870 Mon Sep 17 00:00:00 2001 From: Tom Price Date: Fri, 29 May 2015 15:42:57 +0100 Subject: [PATCH] Fix for changes to sum function --- RIGS/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RIGS/models.py b/RIGS/models.py index 0c06ebbb..3b3024a7 100644 --- a/RIGS/models.py +++ b/RIGS/models.py @@ -297,7 +297,7 @@ class Event(models.Model, RevisionMixin): #total = 0.0 #for item in self.items.filter(cost__gt=0).extra(select="SUM(cost * quantity) AS sum"): # total += item.sum - total = EventItem.objects.filter(event=self).aggregate(sum_total=models.Sum('cost',field="quantity * cost"))['sum_total'] + total = EventItem.objects.filter(event=self).aggregate(sum_total=models.Sum(models.F('cost')*models.F('quantity')))['sum_total'] if total: return total return Decimal("0.00")