{% macro choices(poll) %}
<fieldset>
{% for choice in poll.choices %}
    <input type="checkbox" id="poll{{ poll.id }}-{{ choice.id }}" name="pollanswers-{{ choice.id }}" value="{{ choice.id }}" />
    <label for="poll{{ poll.id }}-{{ choice.id }}">{{ choice.title }}</label><br/>
{% endfor %}
</fieldset>
{% endmacro %}

{% macro results(poll) %}
<table>
    {% for choice, votes in poll.results.most_common() %}
    <tr>
        <td><label for="poll{{ poll.id }}-{{ choice.id }}">{{ choice.title }}</label></td>
        <td>
            <progress id="poll{{ poll.id }}-{{ choice.id }}" value="{{ votes }}" max="{{ len(poll.answers) }}"></progress>
        </td>
        <td>{{ votes }}</td>
    </tr>
    {% endfor %}
    <tr>
        <th>Participations</th><th></th><th>{{ len(poll.answers) }}</th>
    </tr>
</table>
{% endmacro %}
