From c867ce49efc934468a056539b27de41018ed261b Mon Sep 17 00:00:00 2001 From: Tom Price Date: Fri, 29 May 2015 15:20:29 +0100 Subject: [PATCH 1/3] Fix for events without an MIC causing 500 errors for people with permission to view profiles. --- RIGS/templates/RIGS/event_detail.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RIGS/templates/RIGS/event_detail.html b/RIGS/templates/RIGS/event_detail.html index 13d97cf5..c1e21c25 100644 --- a/RIGS/templates/RIGS/event_detail.html +++ b/RIGS/templates/RIGS/event_detail.html @@ -110,7 +110,7 @@ {% if event.is_rig %}
Event MIC
- {% if perms.RIGS.view_profile %} + {% if event.mic and perms.RIGS.view_profile %} {{ event.mic.name }} From 2899c684ac657ee9752cdfbd2e88053748750870 Mon Sep 17 00:00:00 2001 From: Tom Price Date: Fri, 29 May 2015 15:42:57 +0100 Subject: [PATCH 2/3] 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") From 8345ab32281a5b40dc326ca41ff031d910a51fc0 Mon Sep 17 00:00:00 2001 From: Tom Price Date: Fri, 29 May 2015 15:45:14 +0100 Subject: [PATCH 3/3] Add missing explicit fields definition django 1.8 realted --- RIGS/finance.py | 1 + 1 file changed, 1 insertion(+) diff --git a/RIGS/finance.py b/RIGS/finance.py index a6be584c..e0f7ec7a 100644 --- a/RIGS/finance.py +++ b/RIGS/finance.py @@ -115,6 +115,7 @@ class InvoiceEvent(generic.View): class PaymentCreate(generic.CreateView): model = models.Payment + fields = ['invoice','date','amount','method'] def get_initial(self): initial = super(generic.CreateView, self).get_initial()