{% macro wpoll(poll) %} {% import "widgets/polls/"+poll.template as poll_template with context %}

{{ poll.title }}

{# Poll has not begin #} {% if not poll.started %}

Le sondage ouvrira le {{ poll.start | date }}.

{# Poll has ended: display results #} {% elif poll.ended %} {{ poll_template.results(poll) }}

Ce sondage est terminé.

{# Current user is a guest #} {% elif not current_user.is_authenticated %}

Seuls les membres peuvent voter.

{# Current user cannot vote #} {% elif not poll.can_vote(current_user) %}

Vous n'avez pas le droit de voter dans ce sondage.

{# Current user has already voted #} {% elif poll.has_voted(current_user) %} {{ poll_template.results(poll) }}

Vous avez déjà voté.

{# Current user can vote #} {% else %}
{{ poll_template.choices(poll) }}
{% endif %}
{% endmacro %} {{ wpoll(poll) if poll }}