From 0ff0d06eaf9f16267ce5e1e549d5c72f924e20f1 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Sun, 29 May 2016 22:04:48 +0100 Subject: [PATCH] Fix counter on outstanding invoices page ('length' property doesn't work because of the custom SQL query) --- RIGS/finance.py | 1 + RIGS/templates/RIGS/invoice_list_active.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/RIGS/finance.py b/RIGS/finance.py index d604cd57..e90a924a 100644 --- a/RIGS/finance.py +++ b/RIGS/finance.py @@ -25,6 +25,7 @@ class InvoiceIndex(generic.ListView): for i in context['object_list']: total += i.balance context['total'] = total + context['count'] = len(list(context['object_list'])) return context def get_queryset(self): diff --git a/RIGS/templates/RIGS/invoice_list_active.html b/RIGS/templates/RIGS/invoice_list_active.html index 24cea673..23bfc768 100644 --- a/RIGS/templates/RIGS/invoice_list_active.html +++ b/RIGS/templates/RIGS/invoice_list_active.html @@ -5,7 +5,7 @@ Outstanding Invoices {% endblock %} {% block heading %} -Outstanding Invoices ({{object_list|length}} Events, £ {{ total|floatformat:2 }}) +Outstanding Invoices ({{ count }} Events, £ {{ total|floatformat:2 }}) {% endblock %} {% block description %}