Only show published polls for normal users.
This commit is contained in:
parent
91049155a6
commit
1e248ebf23
@ -125,6 +125,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Candidates" %}</th>
|
<th>{% trans "Candidates" %}</th>
|
||||||
{% for poll in assignment.poll_set.all %}
|
{% for poll in assignment.poll_set.all %}
|
||||||
|
{% if poll.published and not perms.assignment.can_manage_assignment or perms.assignment.can_manage_assignment %}
|
||||||
<th style="vertical-align: top; white-space:nowrap;">{% if perms.assignment.can_manage_assignment %}<a href="{% url assignment_poll_view poll.id %}">{% endif %}
|
<th style="vertical-align: top; white-space:nowrap;">{% if perms.assignment.can_manage_assignment %}<a href="{% url assignment_poll_view poll.id %}">{% endif %}
|
||||||
{{ forloop.counter }}. {% trans 'ballot' %}
|
{{ forloop.counter }}. {% trans 'ballot' %}
|
||||||
{% if perms.assignment.can_manage_assignment %}
|
{% if perms.assignment.can_manage_assignment %}
|
||||||
@ -141,6 +142,7 @@
|
|||||||
<a href="{% url assignment_poll_delete poll.id %}"><img src="/static/images/icons/edit-delete.png" title="{% trans 'Delete Poll' %}"></a>
|
<a href="{% url assignment_poll_delete poll.id %}"><img src="/static/images/icons/edit-delete.png" title="{% trans 'Delete Poll' %}"></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</th>
|
</th>
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if assignment.profile.count > 0 and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
{% if assignment.profile.count > 0 and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
||||||
<th>
|
<th>
|
||||||
@ -192,7 +194,9 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{%trans 'Invalid votes' %}</td>
|
<td>{%trans 'Invalid votes' %}</td>
|
||||||
{% for p in polls %}
|
{% for p in polls %}
|
||||||
|
{% if p.published and not perms.assignment.can_manage_assignment or perms.assignment.can_manage_assignment %}
|
||||||
<td style="white-space:nowrap;"><img src="/static/images/icons/voting-invalid.png" title="{% trans 'Invalid' %}"> {{ p.votesinvalid }}</td>
|
<td style="white-space:nowrap;"><img src="/static/images/icons/voting-invalid.png" title="{% trans 'Invalid' %}"> {{ p.votesinvalid }}</td>
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if assignment.profile.count > 0 and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
{% if assignment.profile.count > 0 and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
||||||
<td></td>
|
<td></td>
|
||||||
@ -201,7 +205,9 @@
|
|||||||
<tr class="total">
|
<tr class="total">
|
||||||
<td><b>{%trans 'Votes cast' %}</b></td>
|
<td><b>{%trans 'Votes cast' %}</b></td>
|
||||||
{% for p in polls %}
|
{% for p in polls %}
|
||||||
|
{% if p.published and not perms.assignment.can_manage_assignment or perms.assignment.can_manage_assignment %}
|
||||||
<td style="white-space:nowrap;"><img src="/static/images/icons/voting-total.png" title="{% trans 'Votes cast' %}"> <b>{{ p.votescast }}</b></td>
|
<td style="white-space:nowrap;"><img src="/static/images/icons/voting-total.png" title="{% trans 'Votes cast' %}"> <b>{{ p.votescast }}</b></td>
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if assignment.profile.count > 0 and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
{% if assignment.profile.count > 0 and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
||||||
<td></td>
|
<td></td>
|
||||||
|
@ -69,14 +69,15 @@ def view(request, assignment_id=None):
|
|||||||
for candidate in assignment.candidates:
|
for candidate in assignment.candidates:
|
||||||
tmplist = [[candidate, assignment.is_elected(candidate)], []]
|
tmplist = [[candidate, assignment.is_elected(candidate)], []]
|
||||||
for poll in assignment.poll_set.all():
|
for poll in assignment.poll_set.all():
|
||||||
if candidate in poll.options_values:
|
if (poll.published and not request.user.has_perm('assignment.can_manage_assignment')) or request.user.has_perm('assignment.can_manage_assignment'):
|
||||||
option = Option.objects.filter(poll=poll).filter(user=candidate)[0]
|
if candidate in poll.options_values:
|
||||||
if poll.optiondecision:
|
option = Option.objects.filter(poll=poll).filter(user=candidate)[0]
|
||||||
tmplist[1].append([option.yes, option.no, option.undesided])
|
if poll.optiondecision:
|
||||||
|
tmplist[1].append([option.yes, option.no, option.undesided])
|
||||||
|
else:
|
||||||
|
tmplist[1].append(option.yes)
|
||||||
else:
|
else:
|
||||||
tmplist[1].append(option.yes)
|
tmplist[1].append("-")
|
||||||
else:
|
|
||||||
tmplist[1].append("-")
|
|
||||||
votes.append(tmplist)
|
votes.append(tmplist)
|
||||||
|
|
||||||
polls = []
|
polls = []
|
||||||
|
Loading…
Reference in New Issue
Block a user