From cc10d5042b20dbfb640620b2a660ba48d2d10717 Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Sat, 3 Sep 2011 13:53:37 +0200 Subject: [PATCH] Show invalid votes and votes cast for application and assignment results. --- .../templates/application/poll_view.html | 5 ++++- .../templates/application/view.html | 12 ++++++----- openslides/application/views.py | 7 +++--- .../templates/assignment/poll_view.html | 5 ++++- .../assignment/templates/assignment/view.html | 20 +++++++++++++++++- openslides/assignment/views.py | 14 ++++++++---- openslides/poll/forms.py | 11 ++-------- .../static/images/icons/voting-total.png | Bin 0 -> 912 bytes openslides/static/styles/base.css | 4 ++++ 9 files changed, 54 insertions(+), 24 deletions(-) create mode 100644 openslides/static/images/icons/voting-total.png diff --git a/openslides/application/templates/application/poll_view.html b/openslides/application/templates/application/poll_view.html index 37e13cd1f..75246d0c8 100644 --- a/openslides/application/templates/application/poll_view.html +++ b/openslides/application/templates/application/poll_view.html @@ -29,9 +29,12 @@

{{ options.0.form.undesided.errors }}{{ options.0.form.undesided }}

-

+

{{ form.invalid.errors }}{{ form.invalid }}

+

+ {{ form.votescast.errors }}{{ form.votescast }} +

diff --git a/openslides/application/views.py b/openslides/application/views.py index 69c098618..8053ce6da 100644 --- a/openslides/application/views.py +++ b/openslides/application/views.py @@ -20,7 +20,7 @@ from openslides.application.models import Application from openslides.application.forms import ApplicationForm, \ ApplicationManagerForm from openslides.poll.models import Poll -from openslides.poll.forms import OptionResultForm, PollInvalidForm +from openslides.poll.forms import OptionResultForm, PollForm from openslides.utils.utils import template, permission_required, \ render_to_forbitten, del_confirm_form from openslides.utils.pdf import print_application, print_application_poll @@ -322,9 +322,10 @@ def view_poll(request, poll_id): options = poll.options if request.user.has_perm('application.can_manage_applications'): if request.method == 'POST': - form = PollInvalidForm(request.POST, prefix="poll") + form = PollForm(request.POST, prefix="poll") if form.is_valid(): poll.votesinvalid = form.cleaned_data['invalid'] or 0 + poll.votescast = form.cleaned_data['votescast'] or 0 poll.save() for option in options: @@ -337,7 +338,7 @@ def view_poll(request, poll_id): cleaned_data['undesided'] or 0 option.save() else: - form = PollInvalidForm(initial={'invalid': poll.votesinvalid}, prefix="poll") + form = PollForm(initial={'invalid': poll.votesinvalid, 'votescast': poll.votescast}, prefix="poll") for option in options: option.form = OptionResultForm(initial={ 'yes': option.voteyes, diff --git a/openslides/assignment/templates/assignment/poll_view.html b/openslides/assignment/templates/assignment/poll_view.html index e2c3d47b2..bd96cf983 100644 --- a/openslides/assignment/templates/assignment/poll_view.html +++ b/openslides/assignment/templates/assignment/poll_view.html @@ -33,9 +33,12 @@ {% endfor %} - + {{ form.invalid.errors }}{{ form.invalid }} + + {{ form.votescast.errors }}{{ form.votescast }} + {% if perms.poll.can_manage_poll %}