From c5e15d4aab57da3f4ff8bde078ef356d7347cb32 Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Wed, 1 Aug 2012 20:45:45 +0200 Subject: [PATCH] Show both paid and unpaid invoices --- invoice/views.py | 4 ++-- templates/invoice/index.html | 29 +++++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/invoice/views.py b/invoice/views.py index 84e628e..3dd098f 100644 --- a/invoice/views.py +++ b/invoice/views.py @@ -17,8 +17,8 @@ from invoice.forms import ClientForm, InvoiceForm, InvoiceUpdateForm @login_required def index(request): clients = Client.objects.all() - new_invoices = Invoice.objects.filter(status = 'N') - sent_invoices = Invoice.objects.filter(status = 'S') + unpaid_invoices = Invoice.objects.filter(status__in = ['N', 'S']) + paid_invoices = Invoice.objects.filter(status = 'P') return render_to_response('invoice/index.html', locals()) # ------------------- CLIENT --------------- diff --git a/templates/invoice/index.html b/templates/invoice/index.html index 432ec2f..c0399ba 100644 --- a/templates/invoice/index.html +++ b/templates/invoice/index.html @@ -2,7 +2,7 @@ {% block content %} @@ -13,7 +13,7 @@ -{% for i in new_invoices %} +{% for i in unpaid_invoices %}
Customer Total sum
@@ -30,4 +30,29 @@ {% endfor %}
+ + + + + +{% for i in paid_invoices %} + + + + + + +{% endfor %} +
Invoice # + Date + Customer + Total sum +
+ + {{ i.id }} + + {{ i.date }}{{ i.customer }}{{ i.currency }} {{ i.total_sum }}
+ {% endblock %} -- 2.39.5