comparison gpp/templates/polls/poll_results.html @ 439:1f139de929c4

Fixing #216; added anti-ballot stuffing feature to the polls application.
author Brian Neal <bgneal@gmail.com>
date Sat, 21 May 2011 19:55:48 +0000
parents 88b2b9cb8c1f
children
comparison
equal deleted inserted replaced
438:524fd1b3919a 439:1f139de929c4
13 <script type="text/javascript" src="{{ STATIC_URL }}js/comments.js"></script> 13 <script type="text/javascript" src="{{ STATIC_URL }}js/comments.js"></script>
14 {% endif %} 14 {% endif %}
15 {% endblock %} 15 {% endblock %}
16 {% block content %} 16 {% block content %}
17 <h2>Polls</h2> 17 <h2>Polls</h2>
18 <h3>{{ poll.question }}</h3> 18 <h3>Results for: {{ poll.question }}</h3>
19 <dl class="poll-result"> 19 <dl class="poll-result">
20 {% for choice in choices %} 20 {% for choice in choices %}
21 <dt>{{ choice.choice }} - {{ choice.pct|floatformat }}% ({{ choice.votes }} vote{{ choice.votes|pluralize }})</dt> 21 <dt>{{ choice.choice }} - {{ choice.pct|floatformat }}% ({{ choice.votes }} vote{{ choice.votes|pluralize }})</dt>
22 <dd> 22 <dd>
23 <div class="poll-percent" style="width: {{ choice.pct|floatformat:0 }}%; background-color: teal; color: white;"> 23 <div class="poll-percent" style="width: {{ choice.pct|floatformat:0 }}%; background-color: teal; color: white;">
24 <span>&nbsp;</span></div> 24 <span>&nbsp;</span></div>
25 </dd> 25 </dd>
26 {% endfor %} 26 {% endfor %}
27 </dl> 27 </dl>
28 <p><strong>{{ total_votes }} total vote{{ total_votes|pluralize }}.</strong></p> 28 <p><strong>{{ total_votes }} total vote{{ total_votes|pluralize }}.</strong></p>
29
30 {% if user_choice %}
31 <p>You voted for &quot;{{ user_choice.choice }}&quot;.</p>
32 {% endif %}
33
29 <p class="poll-nav"> 34 <p class="poll-nav">
30 <a href="{{ poll.get_absolute_url }}">Poll Details</a> 35 <a href="{{ poll.get_absolute_url }}">Poll Details</a>
31 {% if poll.is_open and user.is_authenticated %} 36 {% if poll.is_open and user.is_authenticated %}
32 | <a href="{% url 'polls.views.poll_vote' poll_id=poll.id %}">Vote</a> 37 | <a href="{% url 'polls-vote' poll_id=poll.id %}">Vote</a>
33 {% endif %} 38 {% endif %}
34 | <a href="{% url 'polls.views.poll_index' %}">Poll Index</a> 39 | <a href="{% url 'polls-main' %}">All Polls</a>
35 </p> 40 </p>
36 41
37 {% get_comment_count for poll as comment_count %} 42 {% get_comment_count for poll as comment_count %}
38 <p>This poll has <span id="comment-count">{{ comment_count }}</span> comment{{ comment_count|pluralize }}.</p> 43 <p>This poll has <span id="comment-count">{{ comment_count }}</span> comment{{ comment_count|pluralize }}.</p>
39 <hr /> 44 <hr />