From 0d726b2b60626a8d88e6794d2305ba08b444ab7a Mon Sep 17 00:00:00 2001 From: David Taylor Date: Wed, 10 May 2017 20:25:41 +0100 Subject: [PATCH] Fix paperwork printing --- RIGS/finance.py | 6 +++--- RIGS/rigboard.py | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/RIGS/finance.py b/RIGS/finance.py index 26ca0df8..87764189 100644 --- a/RIGS/finance.py +++ b/RIGS/finance.py @@ -55,8 +55,8 @@ class InvoicePrint(generic.View): invoice = get_object_or_404(models.Invoice, pk=pk) object = invoice.event template = get_template('RIGS/event_print.xml') - copies = ('TEC', 'Client') - context = RequestContext(request, { + + context = { 'object': object, 'fonts': { 'opensans': { @@ -66,7 +66,7 @@ class InvoicePrint(generic.View): }, 'invoice': invoice, 'current_user': request.user, - }) + } rml = template.render(context) buffer = StringIO.StringIO() diff --git a/RIGS/rigboard.py b/RIGS/rigboard.py index 81cf564e..0d2c6ec8 100644 --- a/RIGS/rigboard.py +++ b/RIGS/rigboard.py @@ -136,6 +136,7 @@ class EventDuplicate(EventUpdate): context["duplicate"] = True return context + class EventPrint(generic.View): def get(self, request, pk): object = get_object_or_404(models.Event, pk=pk) @@ -144,9 +145,9 @@ class EventPrint(generic.View): merger = PdfFileMerger() - for copy in copies: + for thisCopy in copies: - context = RequestContext(request, { # this should be outside the loop, but bug in 1.8.2 prevents this + context = { # this should be outside the loop, but bug in 1.8.2 prevents this 'object': object, 'fonts': { 'opensans': { @@ -154,9 +155,9 @@ class EventPrint(generic.View): 'bold': 'RIGS/static/fonts/OPENSANS-BOLD.TTF', } }, - 'copy':copy, - 'current_user':request.user, - }) + 'copy': thisCopy, + 'current_user': request.user, + } # context['copy'] = copy # this is the way to do it once we upgrade to Django 1.8.3