From cb2a4b98977ebe357e13dc50ec93a06c9c943cb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Fri, 29 Jun 2012 11:22:47 +0200 Subject: [PATCH] Application PDF: Fix #241 and insert version number --- openslides/application/views.py | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/openslides/application/views.py b/openslides/application/views.py index 954140d8b..7865478ab 100644 --- a/openslides/application/views.py +++ b/openslides/application/views.py @@ -767,20 +767,29 @@ class ApplicationPDF(PDFView): data.append([cell2a,cell2b]) data.append([cell3a,cell3b]) + # Version number (aid) + if application.public_version.aid > 1: + cell4a = [] + cell4a.append(Paragraph("%s:" % _("Version"), stylesheet['Heading4'])) + cell4b = [] + cell4b.append(Paragraph("%s" % application.public_version.aid, stylesheet['Normal'])) + data.append([cell4a,cell4b]) + poll_results = application.get_poll_results() + # voting results if poll_results: - cell4a = [] - cell4a.append(Paragraph("%s:" % _("Vote results"), stylesheet['Heading4'])) - cell4b = [] + cell5a = [] + cell5a.append(Paragraph("%s:" % _("Vote results"), stylesheet['Heading4'])) + cell5b = [] ballotcounter = 0 for result in poll_results: ballotcounter += 1 if len(poll_results) > 1: - cell4b.append(Paragraph("%s. %s" % (ballotcounter, _("Vote")), stylesheet['Bold'])) - cell4b.append(Paragraph("%s: %s
%s: %s
%s: %s
%s: %s
%s: %s" % (_("Yes"), result[0], _("No"), result[1], _("Abstention"), result[2], _("Invalid"), result[3], _("Votes cast"), result[4]), stylesheet['Normal'])) - cell4b.append(Spacer(0,0.2*cm)) - data.append([cell4a,cell4b]) + cell5b.append(Paragraph("%s. %s" % (ballotcounter, _("Vote")), stylesheet['Bold'])) + cell5b.append(Paragraph("%s: %s
%s: %s
%s: %s
%s: %s
%s: %s" % (_("Yes"), result[0], _("No"), result[1], _("Abstention"), result[2], _("Invalid"), result[3], _("Votes cast"), result[4]), stylesheet['Normal'])) + cell5b.append(Spacer(0,0.2*cm)) + data.append([cell5a,cell5b]) t=Table(data) t._argW[0]=4.5*cm @@ -792,12 +801,12 @@ class ApplicationPDF(PDFView): story.append(Spacer(0,1*cm)) # title - story.append(Paragraph(application.title, stylesheet['Heading3'])) + story.append(Paragraph(application.public_version.title, stylesheet['Heading3'])) # text - story.append(Paragraph("%s" % application.text.replace('\r\n','
'), stylesheet['Paragraph'])) + story.append(Paragraph("%s" % application.public_version.text.replace('\r\n','
'), stylesheet['Paragraph'])) # reason story.append(Paragraph(_("Reason")+":", stylesheet['Heading3'])) - story.append(Paragraph("%s" % application.reason.replace('\r\n','
'), stylesheet['Paragraph'])) + story.append(Paragraph("%s" % application.public_version.reason.replace('\r\n','
'), stylesheet['Paragraph'])) return story