Short message on PDF if there are no applications (#249)

This commit is contained in:
Norman Jäckel 2012-06-29 11:42:28 +02:00
parent cb2a4b9897
commit aa30a1900b

View File

@ -700,16 +700,19 @@ class ApplicationPDF(PDFView):
if preamble: if preamble:
story.append(Paragraph("%s" % preamble.replace('\r\n','<br/>'), stylesheet['Paragraph'])) story.append(Paragraph("%s" % preamble.replace('\r\n','<br/>'), stylesheet['Paragraph']))
story.append(Spacer(0,0.75*cm)) story.append(Spacer(0,0.75*cm))
# List of applications if not Application.objects.exists(): # No applications existing
for application in Application.objects.order_by('number'): story.append(Paragraph(_("No applications existing."), stylesheet['Heading3']))
if application.number: else: # Print all Applications
story.append(Paragraph(_("Application No.")+" %s: %s" % (application.number, application.title), stylesheet['Heading3'])) # List of applications
else: for application in Application.objects.order_by('number'):
story.append(Paragraph(_("Application No.")+"&nbsp;&nbsp;&nbsp;: %s" % (application.title), stylesheet['Heading3'])) if application.number:
# Applications details (each application on single page) story.append(Paragraph(_("Application No.")+" %s: %s" % (application.number, application.title), stylesheet['Heading3']))
for application in Application.objects.order_by('number'): else:
story.append(PageBreak()) story.append(Paragraph(_("Application No.")+"&nbsp;&nbsp;&nbsp;: %s" % (application.title), stylesheet['Heading3']))
story = self.get_application(application, story) # 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 else: # print selected application
application = Application.objects.get(id=application_id) application = Application.objects.get(id=application_id)
story = self.get_application(application, story) story = self.get_application(application, story)