From 92d2b1db60241797972f2793a66e510ca665385b Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Sat, 14 Apr 2012 17:09:15 +0200 Subject: [PATCH] ballot methode for AssignmentPoll and ApplicationPoll --- openslides/application/models.py | 3 +++ openslides/application/templates/application/view.html | 2 +- openslides/assignment/models.py | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/openslides/application/models.py b/openslides/application/models.py index 619bd4156..8e9f11c17 100644 --- a/openslides/application/models.py +++ b/openslides/application/models.py @@ -528,6 +528,9 @@ class ApplicationPoll(BasePoll, CountInvalid, CountVotesCast): def get_absolute_url(self): return reverse('application_poll_view', args=[self.id]) + def ballot(self): + return self.application.applicationpoll_set.filter(id__lte=self.id).count() + from django.dispatch import receiver from openslides.config.signals import default_config_value diff --git a/openslides/application/templates/application/view.html b/openslides/application/templates/application/view.html index 101d94618..b70601f00 100644 --- a/openslides/application/templates/application/view.html +++ b/openslides/application/templates/application/view.html @@ -49,7 +49,7 @@

{% trans "Vote results" %}:

{% with application.polls as polls %} - {% if polls|length == 0 %} + {% if polls.exists %} {% if perms.application.can_manage_application %} {% if "genpoll" in actions %} diff --git a/openslides/assignment/models.py b/openslides/assignment/models.py index 649b65eb0..939e68908 100644 --- a/openslides/assignment/models.py +++ b/openslides/assignment/models.py @@ -143,6 +143,9 @@ class AssignmentPoll(BasePoll, CountInvalid, CountVotesCast, PublishPollMixin): CountInvalid.append_pollform_fields(self, fields) CountVotesCast.append_pollform_fields(self, fields) + def ballot(self): + return self.assignment.assignmentpoll_set.filter(id__lte=self.id).count() + @models.permalink def get_absolute_url(self, link='view'): if link == 'view':