Merge pull request #19 from emanuelschuetze/master

Fixes for application and assignment ballot paper
This commit is contained in:
Oskar Hahn 2012-09-18 14:08:12 -07:00
commit 685b138d8d
5 changed files with 290 additions and 266 deletions

View File

@ -833,9 +833,9 @@ class ApplicationPollPDF(PDFView):
# set number of ballot papers # set number of ballot papers
if ballot_papers_selection == "NUMBER_OF_DELEGATES": if ballot_papers_selection == "NUMBER_OF_DELEGATES":
number = User.objects.filter(profile__type__iexact="delegate").count() number = User.objects.filter(type__iexact="delegate").count()
elif ballot_papers_selection == "NUMBER_OF_ALL_PARTICIPANTS": elif ballot_papers_selection == "NUMBER_OF_ALL_PARTICIPANTS":
number = int(Profile.objects.count()) number = int(User.objects.count())
else: # ballot_papers_selection == "CUSTOM_NUMBER" else: # ballot_papers_selection == "CUSTOM_NUMBER"
number = int(ballot_papers_number) number = int(ballot_papers_number)
number = max(1, number) number = max(1, number)

View File

@ -63,8 +63,8 @@
{% for candidate, poll_list in vote_results.items %} {% for candidate, poll_list in vote_results.items %}
<tr class="{% cycle 'odd' '' %}"> <tr class="{% cycle 'odd' '' %}">
<td class="candidate{% if candidate in assignment.elected.all %} elected{% endif %}"> <td class="candidate{% if candidate in assignment.elected %} elected{% endif %}">
{% if candidate in assignment.elected.all %} {% if candidate in assignment.elected %}
<a class="elected"> <a class="elected">
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Candidate is elected' %}"> <img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Candidate is elected' %}">
</a> </a>
@ -72,8 +72,8 @@
{{ candidate }} {{ candidate }}
</td> </td>
{% for vote in poll_list %} {% for vote in poll_list %}
<td style="white-space:nowrap;"{% if candidate in assignment.elected.all %} class="elected"{% endif %}> <td style="white-space:nowrap;"{% if candidate in assignment.elected %} class="elected"{% endif %}>
{% if not assignment_publish_winner_results_only or candidate in assignment.elected.all %} {% if not assignment_publish_winner_results_only or candidate in assignment.elected %}
{% if 'Yes' in vote and 'No' in vote and 'Abstain' in vote %} {% if 'Yes' in vote and 'No' in vote and 'Abstain' in vote %}
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {{ vote.Yes }}<br> <img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {{ vote.Yes }}<br>
<img src="{% static 'images/icons/voting-no.png' %}" title="{% trans 'No' %}"> {{ vote.No }}<br> <img src="{% static 'images/icons/voting-no.png' %}" title="{% trans 'No' %}"> {{ vote.No }}<br>

View File

@ -554,9 +554,9 @@ class AssignmentPollPDF(PDFView):
# set number of ballot papers # set number of ballot papers
if ballot_papers_selection == "NUMBER_OF_DELEGATES": if ballot_papers_selection == "NUMBER_OF_DELEGATES":
number = User.objects.filter(profile__type__iexact="delegate").count() number = User.objects.filter(type__iexact="delegate").count()
elif ballot_papers_selection == "NUMBER_OF_ALL_PARTICIPANTS": elif ballot_papers_selection == "NUMBER_OF_ALL_PARTICIPANTS":
number = int(Profile.objects.count()) number = int(User.objects.count())
else: # ballot_papers_selection == "CUSTOM_NUMBER" else: # ballot_papers_selection == "CUSTOM_NUMBER"
number = int(ballot_papers_number) number = int(ballot_papers_number)
number = max(1, number) number = max(1, number)
@ -567,8 +567,8 @@ class AssignmentPollPDF(PDFView):
candidate = option.candidate candidate = option.candidate
cell.append(Paragraph(candidate.user.get_full_name(), cell.append(Paragraph(candidate.user.get_full_name(),
stylesheet['Ballot_option_name'])) stylesheet['Ballot_option_name']))
if candidate.name_surfix: if candidate.name_suffix:
cell.append(Paragraph("(%s)" % candidate.name_surfix, cell.append(Paragraph("(%s)" % candidate.name_suffix,
stylesheet['Ballot_option_group'])) stylesheet['Ballot_option_group']))
else: else:
cell.append(Paragraph("&nbsp;", cell.append(Paragraph("&nbsp;",

File diff suppressed because it is too large Load Diff