From 818a15aa2b4246a70e06a86254b6465239715b6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Fri, 29 Jun 2012 11:52:23 +0200 Subject: [PATCH] Cf. #249 but now for assignments. --- openslides/assignment/views.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/openslides/assignment/views.py b/openslides/assignment/views.py index 6f9b97b19..209d825e4 100644 --- a/openslides/assignment/views.py +++ b/openslides/assignment/views.py @@ -334,13 +334,16 @@ class AssignmentPDF(PDFView): if preamble: story.append(Paragraph("%s" % preamble.replace('\r\n','
'), stylesheet['Paragraph'])) story.append(Spacer(0,0.75*cm)) - # List of assignments - for assignment in Assignment.objects.order_by('name'): - story.append(Paragraph(assignment.name, stylesheet['Heading3'])) - # Assignment details (each assignment on single page) - for assignment in Assignment.objects.order_by('name'): - story.append(PageBreak()) - story = self.get_assignment(assignment, story) + if not Assignment.objects.exists(): # No assignments existing + story.append(Paragraph(_("No elections existing."), stylesheet['Heading3'])) + else: # Print all assignments + # List of assignments + for assignment in Assignment.objects.order_by('name'): + story.append(Paragraph(assignment.name, stylesheet['Heading3'])) + # Assignment details (each assignment on single page) + for assignment in Assignment.objects.order_by('name'): + story.append(PageBreak()) + story = self.get_assignment(assignment, story) else: # print selected assignment assignment = Assignment.objects.get(id=assignment_id) story = self.get_assignment(assignment, story)