Mercurial > public > sg101
annotate gpp/templates/polls/poll_vote.html @ 507:8631d32e6b16
Some users are still having problems with the pop-up login. I think they are actually getting 403s because of the CSRF protection. So I have modified the base template to always have a javascript variable called csrf_token available when they aren't logged in. The ajax_login.js script was then modified to send this value with the ajax post. Fingers crossed.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 04 Dec 2011 03:05:21 +0000 |
parents | 8f46ba2f1b81 |
children |
rev | line source |
---|---|
gremmie@1 | 1 {% extends 'base.html' %} |
bgneal@310 | 2 {% load url from future %} |
gremmie@1 | 3 {% block title %}Polls: {{ poll.question }}{% endblock %} |
gremmie@1 | 4 {% block custom_css %} |
bgneal@312 | 5 <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/polls.css" /> |
gremmie@1 | 6 {% endblock %} |
gremmie@1 | 7 {% block content %} |
gremmie@1 | 8 <h2>Poll</h2> |
bgneal@439 | 9 <h3>Voting Booth: {{ poll.question }}</h3> |
bgneal@439 | 10 {% if user_choice %} |
bgneal@439 | 11 <p>You voted for "{{ user_choice.choice }}".</p> |
bgneal@439 | 12 <form action="{% url 'polls-delete_vote' %}" method="post">{% csrf_token %} |
gremmie@1 | 13 <div class="poll-form"> |
bgneal@439 | 14 <input type="hidden" name="poll_id" value="{{ poll.id }}" /> |
bgneal@439 | 15 <input type="submit" value="Delete My Vote!" /> |
gremmie@1 | 16 </div> |
gremmie@1 | 17 </form> |
bgneal@439 | 18 {% else %} |
bgneal@439 | 19 <form action="." method="post">{% csrf_token %} |
bgneal@439 | 20 <div class="poll-form"> |
bgneal@439 | 21 {{ vote_form.as_p }} |
bgneal@439 | 22 <input type="submit" value="Vote" /> |
bgneal@439 | 23 </div> |
bgneal@439 | 24 </form> |
bgneal@439 | 25 {% endif %} |
gremmie@1 | 26 <p class="poll-nav"> |
bgneal@447 | 27 <a href="{{ poll.get_absolute_url }}">View results</a> |
bgneal@447 | 28 | <a href="{% url 'polls-main' %}">All polls</a> |
gremmie@1 | 29 </p> |
gremmie@1 | 30 <p>This poll was published on {{ poll.start_date|date:"F d, Y" }}.</p> |
gremmie@1 | 31 {% endblock %} |