From 76e52cf01a84de216cf70357d786a3acec338ee7 Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Mon, 16 Jul 2012 14:29:30 +0200 Subject: [PATCH] #300 dont show votecast and voteinvalid symbols, if the vote has no votes --- .../assignment/templates/assignment/view.html | 43 +++++++++++-------- .../templates/projector/Assignment.html | 28 ++++++++---- openslides/poll/models.py | 2 +- 3 files changed, 46 insertions(+), 27 deletions(-) diff --git a/openslides/assignment/templates/assignment/view.html b/openslides/assignment/templates/assignment/view.html index f4acbc5bd..0e61dc152 100644 --- a/openslides/assignment/templates/assignment/view.html +++ b/openslides/assignment/templates/assignment/view.html @@ -7,29 +7,26 @@ {% block content %}
@@ -180,7 +177,12 @@ {% trans 'Invalid votes' %} {% for poll in polls %} {% if poll.published or perms.assignment.can_manage_assignment %} - {{ poll.print_votesinvalid }} + + {% if poll.has_votes %} + + {{ poll.print_votesinvalid }} + {% endif %} + {% endif %} {% endfor %} {% if assignment.profile.exists and perms.assignment.can_manage_assignment and assignment.status == "vot" %} @@ -192,7 +194,12 @@ {% trans 'Votes cast' %} {% for poll in polls %} {% if poll.published or perms.assignment.can_manage_assignment %} - {{ poll.print_votescast }} + + {% if poll.has_votes %} + + {{ poll.print_votescast }} + {% endif %} + {% endif %} {% endfor %} {% if assignment.profile.exists and perms.assignment.can_manage_assignment and assignment.status == "vot" %} diff --git a/openslides/assignment/templates/projector/Assignment.html b/openslides/assignment/templates/projector/Assignment.html index 091683d91..d516baa88 100644 --- a/openslides/assignment/templates/projector/Assignment.html +++ b/openslides/assignment/templates/projector/Assignment.html @@ -55,7 +55,9 @@ {% trans "Candidates" %} {% for poll in polls %} - {{ poll.get_ballot }}. {% trans "ballot" %} + + {{ poll.get_ballot }}. {% trans "ballot" %} + {% endfor %} @@ -94,18 +96,28 @@ {% trans 'Invalid votes' %} {% for poll in polls %} - {% if poll.published %} - {{ poll.print_votesinvalid }} - {% endif %} + + {% if poll.has_votes %} + + {{ poll.print_votesinvalid }} + {% endif %} + + {% endfor %} - {% trans 'Votes cast' %} + + {% trans 'Votes cast' %} + {% for poll in polls %} - {% if poll.published %} - {{ poll.print_votescast }} - {% endif %} + + + {% if poll.has_votes %} + + {{ poll.print_votescast }} + {% endif %} + {% endfor %} diff --git a/openslides/poll/models.py b/openslides/poll/models.py index 7f8a72ff2..add325b66 100644 --- a/openslides/poll/models.py +++ b/openslides/poll/models.py @@ -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