comparison gpp/templates/polls/index.html @ 440:ac9217eef610

Added total vote information to the poll templates. Cache the total votes in the model instance.
author Brian Neal <bgneal@gmail.com>
date Sat, 21 May 2011 20:35:02 +0000
parents dbd703f7d63a
children
comparison
equal deleted inserted replaced
439:1f139de929c4 440:ac9217eef610
6 <h3>Current Polls</h3> 6 <h3>Current Polls</h3>
7 {% if current_polls %} 7 {% if current_polls %}
8 <ul> 8 <ul>
9 {% for poll in current_polls %} 9 {% for poll in current_polls %}
10 <li><a href="{{ poll.get_absolute_url }}">{{ poll.question }}</a> &bull; 10 <li><a href="{{ poll.get_absolute_url }}">{{ poll.question }}</a> &bull;
11 {{ poll.total_votes }} vote{{ poll.total_votes|pluralize }} &bull;
11 {% get_comment_count for poll as comment_count %} 12 {% get_comment_count for poll as comment_count %}
12 {{ comment_count }} comment{{ comment_count|pluralize }} &bull; 13 {{ comment_count }} comment{{ comment_count|pluralize }} &bull;
13 {{ poll.start_date|date:"M d, Y" }} 14 {{ poll.start_date|date:"M d, Y" }}
14 {% if poll.end_date %} 15 {% if poll.end_date %}
15 - {{ poll.end_date|date:"M d, Y" }} 16 - {{ poll.end_date|date:"M d, Y" }}
23 <h3>Closed Polls</h3> 24 <h3>Closed Polls</h3>
24 {% if old_polls %} 25 {% if old_polls %}
25 <ul> 26 <ul>
26 {% for poll in old_polls %} 27 {% for poll in old_polls %}
27 <li><a href="{{ poll.get_absolute_url }}">{{ poll.question }}</a> &bull; 28 <li><a href="{{ poll.get_absolute_url }}">{{ poll.question }}</a> &bull;
29 {{ poll.total_votes }} vote{{ poll.total_votes|pluralize }} &bull;
28 {% get_comment_count for poll as comment_count %} 30 {% get_comment_count for poll as comment_count %}
29 {{ comment_count }} comment{{ comment_count|pluralize }} &bull; 31 {{ comment_count }} comment{{ comment_count|pluralize }} &bull;
30 {{ poll.start_date|date:"M d, Y" }} - 32 {{ poll.start_date|date:"M d, Y" }} -
31 {{ poll.end_date|date:"M d, Y" }}</li> 33 {{ poll.end_date|date:"M d, Y" }}</li>
32 {% endfor %} 34 {% endfor %}