1👍
You need to either use a RequestContext
or return the context you have created with c.update(csrf(request))
:
https://docs.djangoproject.com/en/dev/ref/contrib/csrf/
Use RequestContext, which always uses ‘django.core.context_processors.csrf’ (no matter what your TEMPLATE_CONTEXT_PROCESSORS setting). If you are using generic views or contrib apps, you are covered already, since these apps use RequestContext throughout.
Manually import and use the processor to generate the CSRF token and add it to the template context. e.g….
return render_to_response("login_home.html",
{"username":username, "password":password}
context_instance=RequestContext(request))
Source:stackexchange.com