Add total for waiting events

This commit is contained in:
Tom Price
2016-05-24 17:32:58 +01:00
parent 6030288956
commit 7ccc8faf20
2 changed files with 9 additions and 1 deletions

View File

@@ -103,6 +103,14 @@ class InvoiceWaiting(generic.ListView):
paginate_by = 25
template_name = 'RIGS/event_invoice.html'
def get_context_data(self, **kwargs):
context = super(InvoiceWaiting, self).get_context_data(**kwargs)
total = 0
for obj in context['object_list']:
total += obj.sum_total
context['total'] = total
return context
def get_queryset(self):
# @todo find a way to select items
events = self.model.objects.filter(is_rig=True, end_date__lt=datetime.date.today(),

View File

@@ -5,7 +5,7 @@
{% block content %}
<div class="col-sm-12">
<h2>Events for Invoice</h2>
<h2>Events for Invoice (£ {{ total|floatformat:2 }})</h2>
{% if is_paginated %}
<div class="col-md-6 col-md-offset-6 col-sm-12 text-right">
{% paginator %}