into the request header easily.
That would be mandatory if one was going to be utilizing user post
data frequently however.
For what it's worth, I simply used this instead -->
<form id="vote" action="/votingConfirm/" method="post">{% csrf_token %}
<input name="person" type="text">
</form>
function confirmation(person) {
var answer = confirm('You are about to cast your vote for '+person)
if ( answer )
{
var submitForm = document.getElementById("vote");
document.body.appendChild(submitForm);
var element = document.getElementById("vote");
element.person.value = person;
element.submit();
}
On Tue, Jan 24, 2012 at 11:39 AM, Reinout van Rees <reinout@vanrees.org> wrote:
> On 24-01-12 16:47, Robert Steckroth wrote:
>>
>> Hey Gang, is it possible to include a csrf token with a xml post?
>> It looks like there are options in the view to control this but
>> getting into the header would be nice.
>
>
> Django made it easy for you! There's a javascript snippet you can copy/paste
> that takes care of including the csrf token:
>
> https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ajax
>
>
>
> Reinout
>
> --
> Reinout van Rees http://reinout.vanrees.org/
> reinout@vanrees.org http://www.nelen-schuurmans.nl/
> "If you're not sure what to do, make something. -- Paul Graham"
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
--
Bust0ut Surgemcgee ---
BudTVNetwork.com
RadioWeedShow.com
PBDefence.com
"Bringing entertainment to Unix"
"Finding the exit without looking"
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment