Fixed #1326: Assignment PDF fails when having a lot of posts.

Print always 7 signature lines in assingment pdf.
Added test.
This commit is contained in:
Emanuel Schuetze 2014-10-10 19:01:34 +02:00
parent c6586c2c70
commit 2a389b4a7f
2 changed files with 6 additions and 1 deletions

View File

@ -364,7 +364,7 @@ class AssignmentPDF(PDFView):
"<seq id='counter'/>.&nbsp; %s" % candidate,
stylesheet['Signaturefield']))
if assignment.status == "sea":
for x in range(0, 2 * assignment.posts):
for x in range(0, 7):
cell2b.append(
Paragraph(
"<seq id='counter'/>.&nbsp; "

View File

@ -20,3 +20,8 @@ class AssignmentPDFTest(TestCase):
Assignment.objects.create(name='assignment_name_ith8qua1Eiferoqu5ju2', description="test", posts=1)
response = self.admin_client.get('/assignment/print/')
self.assertEqual(response.status_code, 200)
def test_render_many_posts(self):
Assignment.objects.create(name='assignment_name_cohZ9shaipee3Phaing4', description="test", posts=20)
response = self.admin_client.get('/assignment/print/')
self.assertEqual(response.status_code, 200)