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:
story.append(Paragraph("%s" % preamble.replace('\r\n','<br/>'), 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.")+"&nbsp;&nbsp;&nbsp;: %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.")+"&nbsp;&nbsp;&nbsp;: %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)