diff gpp/templates/polls/poll_vote.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 8f46ba2f1b81
line wrap: on
line diff
--- a/gpp/templates/polls/poll_vote.html	Wed May 18 03:04:25 2011 +0000
+++ b/gpp/templates/polls/poll_vote.html	Sat May 21 19:55:48 2011 +0000
@@ -6,17 +6,27 @@
 {% endblock %}
 {% block content %}
 <h2>Poll</h2>
-<h3>{{ poll.question }}</h3>
-<form action="." method="post">{% csrf_token %}
+<h3>Voting Booth: {{ poll.question }}</h3>
+{% if user_choice %}
+<p>You voted for &quot;{{ user_choice.choice }}&quot;.</p>
+<form action="{% url 'polls-delete_vote' %}" method="post">{% csrf_token %}
    <div class="poll-form">
-   {{ vote_form.as_p }}
-   <input type="submit" value="Vote" />
+      <input type="hidden" name="poll_id" value="{{ poll.id }}" />
+      <input type="submit" value="Delete My Vote!" />
    </div>
 </form>
+{% else %}
+   <form action="." method="post">{% csrf_token %}
+      <div class="poll-form">
+      {{ vote_form.as_p }}
+      <input type="submit" value="Vote" />
+      </div>
+   </form>
+{% endif %}
 <p class="poll-nav">
 <a href="{{ poll.get_absolute_url }}">Poll Details</a>
-| <a href="{% url 'polls.views.poll_results' poll.id %}">View Results</a>
-| <a href="{% url 'polls.views.poll_index' %}">Poll Index</a>
+| <a href="{% url 'polls-results' poll.id %}">View Results</a>
+| <a href="{% url 'polls-main' %}">All Polls</a>
 </p>
 <p>This poll was published on {{ poll.start_date|date:"F d, Y" }}.</p>
 {% endblock %}