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)