#300 dont show votecast and voteinvalid symbols, if the vote has no votes
This commit is contained in:
parent
4e5884bda4
commit
76e52cf01a
@ -7,7 +7,6 @@
|
||||
|
||||
{% block content %}
|
||||
<div id="sidebar">
|
||||
|
||||
<div class="box">
|
||||
<h4>{% trans "Status" %}:</h4>
|
||||
{% trans assignment.get_status_display %}
|
||||
@ -28,8 +27,6 @@
|
||||
{% if 'fin' in assignment.status %}checked{% endif %}>{% trans 'Finish' %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div style="margin-right: 250px; min-width: 400px;">
|
||||
@ -180,7 +177,12 @@
|
||||
<td>{% trans 'Invalid votes' %}</td>
|
||||
{% for poll in polls %}
|
||||
{% if poll.published or perms.assignment.can_manage_assignment %}
|
||||
<td style="white-space:nowrap;"><img src="{% static 'images/icons/voting-invalid.png' %}" title="{% trans 'Invalid' %}"> {{ poll.print_votesinvalid }}</td>
|
||||
<td style="white-space:nowrap;">
|
||||
{% if poll.has_votes %}
|
||||
<img src="{% static 'images/icons/voting-invalid.png' %}" title="{% trans 'Invalid' %}">
|
||||
{{ poll.print_votesinvalid }}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if assignment.profile.exists and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
||||
@ -192,7 +194,12 @@
|
||||
<td><strong>{% trans 'Votes cast' %}</strong></td>
|
||||
{% for poll in polls %}
|
||||
{% if poll.published or perms.assignment.can_manage_assignment %}
|
||||
<td style="white-space:nowrap;"><img src="{% static 'images/icons/voting-total.png' %}" title="{% trans 'Votes cast' %}"> <strong>{{ poll.print_votescast }}</strong></td>
|
||||
<td style="white-space:nowrap;">
|
||||
{% if poll.has_votes %}
|
||||
<img src="{% static 'images/icons/voting-total.png' %}" title="{% trans 'Votes cast' %}">
|
||||
<strong>{{ poll.print_votescast }}</strong>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if assignment.profile.exists and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
||||
|
@ -55,7 +55,9 @@
|
||||
<tr>
|
||||
<th>{% trans "Candidates" %}</th>
|
||||
{% for poll in polls %}
|
||||
<th><nobr>{{ poll.get_ballot }}. {% trans "ballot" %}</nobr></th>
|
||||
<th>
|
||||
<nobr>{{ poll.get_ballot }}. {% trans "ballot" %}</nobr>
|
||||
</th>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
|
||||
@ -94,18 +96,28 @@
|
||||
<tr>
|
||||
<td>{% trans 'Invalid votes' %}</td>
|
||||
{% for poll in polls %}
|
||||
{% if poll.published %}
|
||||
<td style="white-space:nowrap;"><img src="{% static 'images/icons/voting-invalid.png' %}" title="{% trans 'Invalid' %}"> {{ poll.print_votesinvalid }}</td>
|
||||
<td style="white-space:nowrap;">
|
||||
{% if poll.has_votes %}
|
||||
<img src="{% static 'images/icons/voting-invalid.png' %}" title="{% trans 'Invalid' %}">
|
||||
{{ poll.print_votesinvalid }}
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
{% endfor %}
|
||||
</tr>
|
||||
|
||||
<tr class="total">
|
||||
<td><b>{% trans 'Votes cast' %}</b></td>
|
||||
<td>
|
||||
<strong>{% trans 'Votes cast' %}</strong>
|
||||
</td>
|
||||
{% for poll in polls %}
|
||||
{% if poll.published %}
|
||||
<td style="white-space:nowrap;"><img src="{% static 'images/icons/voting-total.png' %}" title="{% trans 'Votes cast' %}"> <b>{{ poll.print_votescast }}</b></td>
|
||||
|
||||
<td style="white-space:nowrap;">
|
||||
{% if poll.has_votes %}
|
||||
<img src="{% static 'images/icons/voting-total.png' %}" title="{% trans 'Votes cast' %}">
|
||||
<strong>{{ poll.print_votescast }}</strong>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
|
||||
|
@ -175,7 +175,7 @@ class BasePoll(models.Model):
|
||||
"""
|
||||
Return a QuerySet with all vote objects, releatet to this poll.
|
||||
"""
|
||||
return self.get_vote_class().objects
|
||||
return self.get_vote_class().objects.filter(option__poll__id=self.id)
|
||||
|
||||
def set_form_values(self, option, data):
|
||||
# TODO: recall this function. It has nothing to do with a form
|
||||
|
Loading…
Reference in New Issue
Block a user