{% extends "core/base.jinja" %} {% block title %} {{ object.title }} {% endblock %} {% block head %} {{ super() -}} {%- endblock %} {% block additional_css %} {% endblock %} {% block content %}

{{ election.title }}

{{ election.description }}


{%- if election.is_vote_active %} {% trans %}Polls close {% endtrans %} {%- elif election.is_vote_finished %} {% trans %}Polls closed {% endtrans %} {%- else %} {% trans %}Polls will open {% endtrans %} {% trans %} at {% endtrans %} {% trans %}and will close {% endtrans %} {%- endif %} {% trans %} at {% endtrans %}

{%- if election.has_voted(user) %}

{%- if election.is_vote_active %} {% trans %}You already have submitted your vote.{% endtrans %} {%- else %} {% trans %}You have voted in this election.{% endtrans %} {%- endif %}

{%- endif %}
{% csrf_token %} {%- set election_lists = election.election_lists.all() -%} {%- for election_list in election_lists %} {%- endfor %} {%- set role_list = election.roles.order_by('order').all() %} {%- for role in role_list %} {%- set count = [0] %} {%- set role_data = election_form.data.getlist(role.title) if role.title in election_form.data else [] %} {%- for election_list in election_lists %} {%- endfor %} {%- endfor %}
{% trans %}Blank vote{% endtrans %} {{ election_list.title }} {% if user.can_edit(election_list) and election.is_vote_editable -%} {% endif %}

{{ role.title }}

{{ role.description }}

{%- if role.max_choice > 1 and not election.has_voted(user) and election.can_vote(user) %} {% trans %}You may choose up to{% endtrans %} {{ role.max_choice }} {% trans %}people.{% endtrans %} {%- endif %} {%- if election_form.errors[role.title] is defined %} {%- for error in election_form.errors.as_data()[role.title] %} {{ error.message }} {%- endfor %} {%- endif %}
{% if user.can_edit(role) and election.is_vote_editable -%}
{%- if role == role_list.last() %} {%- else %} {%- endif %} {% if role == role_list.first() %} {% else %} {% endif %}
{%- endif -%}
{%- if role.max_choice == 1 and election.can_vote(user) %}
{%- set _ = count.append(count.pop() + 1) %} {%- endif %} {%- if election.is_vote_finished %} {%- set results = election_results[role.title]['blank vote'] %}
{{ results.vote }} {% trans %}votes{% endtrans %} ({{ "%.2f" % results.percent }} %)
{%- endif %}
    {%- for candidature in election_list.candidatures.filter(role=role) %}
  • {%- if election.can_vote(user) %} {%- set _ = count.append(count.pop() + 1) %} {%- endif %} {%- if election.is_vote_finished %} {%- set results = election_results[role.title][candidature.user.username] %}
    {{ results.vote }} {% trans %}votes{% endtrans %} ({{ "%.2f" % results.percent }} %)
    {%- endif %}
  • {%- endfor %}
{%- if (election.can_candidate(user) and election.is_candidature_active) or (user.can_edit(election) and election.is_vote_editable) %} {% trans %}Candidate{% endtrans %} {%- endif %} {%- if election.is_vote_editable %} {% trans %}Add a new list{% endtrans %} {%- endif %} {%- if user.can_edit(election) %} {% if election.is_vote_editable %} {% trans %}Add a new role{% endtrans %} {% endif %} {% trans %}Edit{% endtrans %} {%- endif %} {%- if user.is_root %} {% trans %}Delete{% endtrans %} {%- endif %}
{%- if not election.has_voted(user) and election.can_vote(user) %}
{%- endif %} {% endblock %} {% block script %} {{ super() }} {% endblock %}