{% extends "base.html" %} {% block page_title %}{{ page_title | default(value="Opinion Polls") }}{% endblock %} {% block head %} {% endblock %} {% block content %}

{{ page_title | default(value="Opinion Polls") }}

{% if can_create %} + New poll {% endif %}
{% if migration_error %}
Poll expiry data could not be fully updated: {{ migration_error }}
{% endif %}

Before you vote

Fill your details once, read the disclaimer, then choose Agree or Disagree. Your choice is saved on the server and polls are fetched only after you agree.

{% if ballot_form %}

{{ ballot_form.label }}

{% if has_ballot_profile %}Your voter details are saved and read-only.{% else %}Fill this once — it is saved with every vote on this page{% if ballot_form.required %} and required before voting{% endif %}.{% endif %}

{% for f in ballot_form.fields %} {% set saved = ballot_answers[f.name] | default(value="") %}
{% if f.field_type == "textarea" %} {% elif f.field_type == "select" %} {% elif f.field_type == "checkbox" %} {% elif f.field_type == "number" %} {% elif f.field_type == "date" %} {% elif f.field_type == "email" %} {% elif f.field_type == "tel" %} {% else %} {% endif %}
{% endfor %}
{% endif %} {% if disclaimer %}

Voter disclaimer

{{ disclaimer | safe }}
{% if disclaimer_agreed %}
Agreed
{% else %}
{% endif %}
{% endif %} {% if disclaimer_agreed %}

Your details

Saved and read-only.

{% endif %}
{% if can_create %} {% endif %}
{% for poll in polls %}

{{ poll.question }}

By {{ poll.creator_name | default(value="Someone") }} {{ poll.created_at | date_in_tz(timezone=settings.timezone, format="%d %b %Y") }} {{ poll.voter_count }} voter{% if poll.voter_count != 1 %}s{% endif %} {% if poll.results_public == 1 %}Public results{% elif poll.results_public == 2 %}Results on close{% else %}Private results{% endif %} {% if poll.allow_multi_choice == 1 %}Multi-choice{% else %}Single choice{% endif %} {% if poll.is_expired == 1 %}Expired{% endif %}
{% if poll.is_active == 1 and poll.is_expired == 0 and not poll.has_voted %}
{% for opt in poll.options %} {% endfor %}
{% endif %} {% if poll.has_voted %}

You voted on this poll.

{% endif %} {% if poll.results_visible %}
{% for opt in poll.options %} {% set opt_idx = loop.index0 %} {% set_global opt_votes = 0 %} {% for t in poll.tallies | default(value=[]) %} {% if t.option_index == opt_idx %}{% set_global opt_votes = t.votes %}{% endif %} {% endfor %}
{{ opt }} {{ opt_votes }} vote{% if opt_votes != 1 %}s{% endif %}
{% if poll.vote_count > 0 %}
{% endif %}
{% endfor %}
{% else %} {% if poll.results_public == 2 %}

Results for this poll will be visible to everyone once the poll closes. Individual choices are never published.

{% elif poll.results_public == 0 %}

Results for this poll are private and visible only to the creator. Individual choices are never published.

{% endif %} {% endif %}
{% else %}

No active polls yet. Check back soon.

{% if can_create %}

Create the first poll

{% endif %}
{% endfor %}
{% if can_create %} {% endif %}
{% endblock %}