From aa30a1900b6ace2ef75af7b79a9c431949a75b36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Fri, 29 Jun 2012 11:42:28 +0200 Subject: [PATCH] Short message on PDF if there are no applications (#249) --- openslides/application/views.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/openslides/application/views.py b/openslides/application/views.py index 7865478ab..8f4c060fd 100644 --- a/openslides/application/views.py +++ b/openslides/application/views.py @@ -700,16 +700,19 @@ class ApplicationPDF(PDFView): if preamble: story.append(Paragraph("%s" % preamble.replace('\r\n','
'), stylesheet['Paragraph'])) story.append(Spacer(0,0.75*cm)) - # List of applications - for application in Application.objects.order_by('number'): - if application.number: - story.append(Paragraph(_("Application No.")+" %s: %s" % (application.number, application.title), stylesheet['Heading3'])) - else: - story.append(Paragraph(_("Application No.")+"   : %s" % (application.title), stylesheet['Heading3'])) - # Applications details (each application on single page) - for application in Application.objects.order_by('number'): - story.append(PageBreak()) - story = self.get_application(application, story) + if not Application.objects.exists(): # No applications existing + story.append(Paragraph(_("No applications existing."), stylesheet['Heading3'])) + else: # Print all Applications + # List of applications + for application in Application.objects.order_by('number'): + if application.number: + story.append(Paragraph(_("Application No.")+" %s: %s" % (application.number, application.title), stylesheet['Heading3'])) + else: + story.append(Paragraph(_("Application No.")+"   : %s" % (application.title), stylesheet['Heading3'])) + # Applications details (each application on single page) + for application in Application.objects.order_by('number'): + story.append(PageBreak()) + story = self.get_application(application, story) else: # print selected application application = Application.objects.get(id=application_id) story = self.get_application(application, story)