Mercurial > public > sg101
annotate gpp/templates/polls/poll.html @ 368:b76af55aafe4
For #176; cache the output of the latest poll block template tag.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 05 Mar 2011 21:00:00 +0000 |
parents | daa2916f5b34 |
children | 1f139de929c4 |
rev | line source |
---|---|
gremmie@1 | 1 {% extends 'base.html' %} |
bgneal@310 | 2 {% load url from future %} |
gremmie@1 | 3 {% load comment_tags %} |
gremmie@1 | 4 {% block title %}Polls: {{ poll.question }}{% endblock %} |
gremmie@1 | 5 {% block content %} |
gremmie@1 | 6 <h2>Poll</h2> |
gremmie@1 | 7 <h3>{{ poll.question }}</h3> |
gremmie@1 | 8 <ul class="poll-detail"> |
gremmie@1 | 9 {% for choice in poll.choice_set.all %} |
gremmie@1 | 10 <li>{{ choice.choice }}</li> |
gremmie@1 | 11 {% endfor %} |
gremmie@1 | 12 </ul> |
gremmie@1 | 13 {% get_comment_count for poll as comment_count %} |
gremmie@1 | 14 <p> |
bgneal@310 | 15 This poll has <a href="{% url 'polls.views.poll_results' poll.id %}">{{ comment_count }} comment{{ comment_count|pluralize }}</a>. |
gremmie@1 | 16 {% if poll.is_open %} |
gremmie@1 | 17 Voting for this poll started on {{ poll.start_date|date:"F d, Y" }}. |
gremmie@1 | 18 {% if poll.end_date %} |
gremmie@1 | 19 Voting will end on {{ poll.end_date|date:"F d, Y" }}. |
gremmie@1 | 20 {% endif %} |
gremmie@1 | 21 {% else %} |
gremmie@1 | 22 This poll ran from {{ poll.start_date|date:"F d, Y" }} to {{ poll.end_date|date:"F d, Y" }}. |
gremmie@1 | 23 {% endif %} |
gremmie@1 | 24 </p> |
gremmie@1 | 25 <p class="poll-nav"> |
bgneal@310 | 26 <a href="{% url 'polls.views.poll_results' poll.id %}">View Results & Comments</a> |
gremmie@1 | 27 {% if poll.is_open and user.is_authenticated %} |
bgneal@310 | 28 | <a href="{% url 'polls.views.poll_vote' poll_id=poll.id %}">Vote</a> |
gremmie@1 | 29 {% endif %} |
bgneal@310 | 30 | <a href="{% url 'polls.views.poll_index' %}">Poll Index</a> |
gremmie@1 | 31 </p> |
gremmie@1 | 32 {% endblock %} |