Open GoogleCodeExporter opened 8 years ago
Just to be clear, the old-style CSRF works however the new Django 1.2 CSRF
middleware
doesn't.
No changes have been made to support Django 1.2 at this stage; I'm sure there
will be
more to come. We also need to make sure we stay compatible with earlier
versions of
Django.
Original comment by rwpoul...@gmail.com
on 10 Apr 2010 at 3:59
Hi guys,
Thanks for this great software. I just added it to a Django 1.2.3. project and
I am having the problem above with CSRF. What is the workaround? (I have tried
adding csrf_protect tags in the templates concerned as well as having the CSRF
Middleware in my settings. No joy still, otherwise the admin works fine. What
to do?
Original comment by zebr...@gmail.com
on 14 Oct 2010 at 8:56
[deleted comment]
The workaround I've found is:
1. In views.py add:
from django.core.context_processors import csrf
2. In every single view dealing with POSTing forms not using RequestContext add:
c = {}
c.update(csrf(request))
and in the returned generic views not using RequestContext add in extra_content
dictionary:
'csrf': c,
3. In all templates containing form add right after form tag:
{% csrf_token %}
AFAIK the only view/template not dealing with POSTing forms is forums list.
Attached summary diff from mercurial.
HTH.
Cheers.
Original comment by aspon...@gmail.com
on 18 Oct 2010 at 10:36
Attachments:
Original issue reported on code.google.com by
dr.z...@googlemail.com
on 9 Apr 2010 at 11:20