Cf. #249 but now for assignments.

This commit is contained in:
Norman Jäckel 2012-06-29 11:52:23 +02:00
parent aa30a1900b
commit 818a15aa2b

View File

@ -334,13 +334,16 @@ class AssignmentPDF(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 assignments if not Assignment.objects.exists(): # No assignments existing
for assignment in Assignment.objects.order_by('name'): story.append(Paragraph(_("No elections existing."), stylesheet['Heading3']))
story.append(Paragraph(assignment.name, stylesheet['Heading3'])) else: # Print all assignments
# Assignment details (each assignment on single page) # List of assignments
for assignment in Assignment.objects.order_by('name'): for assignment in Assignment.objects.order_by('name'):
story.append(PageBreak()) story.append(Paragraph(assignment.name, stylesheet['Heading3']))
story = self.get_assignment(assignment, story) # 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 else: # print selected assignment
assignment = Assignment.objects.get(id=assignment_id) assignment = Assignment.objects.get(id=assignment_id)
story = self.get_assignment(assignment, story) story = self.get_assignment(assignment, story)