[Django]-Failed CSRF token verification in Mezzanine with captcha form

2👍

You must ensure that:

The view function uses RequestContext for the template, instead of Context.

But you use:

return render_to_response('captcha.html', locals())

And, from the documentation to render_to_response:

By default, the template will be rendered with a Context instance (filled with values from dictionary). If you need to use context processors, render the template with a RequestContext instance instead.

So adding context_instance=RequestContext(request) should solve the problem.

Leave a comment