Mercurial > public > sg101
view 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 |
line wrap: on
line source
{% extends 'base.html' %} {% load url from future %} {% block title %}Polls: {{ poll.question }}{% endblock %} {% block custom_css %} <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/polls.css" /> {% endblock %} {% block content %} <h2>Poll</h2> <h3>Voting Booth: {{ poll.question }}</h3> {% if user_choice %} <p>You voted for "{{ user_choice.choice }}".</p> <form action="{% url 'polls-delete_vote' %}" method="post">{% csrf_token %} <div class="poll-form"> <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 }}">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 %}