Turn on Yes-No-Abstain Ballot for Assignments/Elections, #108

This commit is contained in:
Norman Jäckel 2012-06-28 18:45:00 +02:00
parent 59fb053283
commit 3156c8b4b5

View File

@ -516,37 +516,36 @@ class AssignmentPollPDF(PDFView):
number = 1
ballot_papers_selection = config["assignment_pdf_ballot_papers_selection"]
ballot_papers_number = config["assignment_pdf_ballot_papers_number"]
# TODO: 'optiondecision'
#if self.poll.optiondecision:
# for option in options:
# o = str(option).split("(",1)
# cell.append(Paragraph(o[0], stylesheet['Ballot_option_name']))
# if len(o) > 1:
# cell.append(Paragraph("("+o[1], stylesheet['Ballot_option_group']))
# else:
# cell.append(Paragraph(" ", stylesheet['Ballot_option_group']))
# cell.append(Paragraph(circle+_("Yes")+"      "+circle+_("No")+"      "+circle+_("Abstention"), stylesheet['Ballot_option_YNA']))
# # set number of ballot papers
# if ballot_papers_selection == "1":
# number = User.objects.filter(profile__type__iexact="delegate").count()
# if ballot_papers_selection == "2":
# number = int(User.objects.count() - 1)
# if ballot_papers_selection == "0":
# number = int(ballot_papers_number)
# # print ballot papers
# for user in xrange(number/2):
# data.append([cell,cell])
# rest = number % 2
# if rest:
# data.append([cell,''])
# if len(options) <= 2:
# t=Table(data, 10.5*cm, 7.42*cm)
# elif len(options) <= 5:
# t=Table(data, 10.5*cm, 14.84*cm)
# else:
# t=Table(data, 10.5*cm, 29.7*cm)
#else:
# Choose kind of ballot paper
if self.poll.yesnoababstain:
for option in options:
o = str(option).split("(",1)
cell.append(Paragraph(o[0], stylesheet['Ballot_option_name']))
if len(o) > 1:
cell.append(Paragraph("("+o[1], stylesheet['Ballot_option_group']))
else:
cell.append(Paragraph("&nbsp;", stylesheet['Ballot_option_group']))
cell.append(Paragraph(circle+_("Yes")+"&nbsp; &nbsp; &nbsp; "+circle+_("No")+"&nbsp; &nbsp; &nbsp; "+circle+_("Abstention"), stylesheet['Ballot_option_YNA']))
# set number of ballot papers
if ballot_papers_selection == "1":
number = User.objects.filter(profile__type__iexact="delegate").count()
if ballot_papers_selection == "2":
number = int(User.objects.count() - 1)
if ballot_papers_selection == "0":
number = int(ballot_papers_number)
# print ballot papers
for user in xrange(number/2):
data.append([cell,cell])
rest = number % 2
if rest:
data.append([cell,''])
if len(options) <= 2:
t=Table(data, 10.5*cm, 7.42*cm)
elif len(options) <= 5:
t=Table(data, 10.5*cm, 14.84*cm)
else:
t=Table(data, 10.5*cm, 29.7*cm)
else:
for option in options:
o = str(option).split("(",1)
cell.append(Paragraph(circle+o[0], stylesheet['Ballot_option_name']))
@ -570,7 +569,6 @@ class AssignmentPollPDF(PDFView):
rest = number % 2
if rest:
data.append([cell,''])
if len(options) <= 4:
t=Table(data, 10.5*cm, 7.42*cm)
elif len(options) <= 8: