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