[Answer]-CSRF verification failed despite following documentation

1👍

According to the doc

If you’re using Django’s render_to_response() shortcut to populate a template with the contents of a dictionary, your template will be passed a Context instance by default (not a RequestContext). To use a RequestContext in your template rendering, pass an optional third argument to render_to_response(): a RequestContext instance. Your code might look like this:

from django.template import RequestContext 
def getData(request):
  c = {}
  c.update(csrf(request))
  return render_to_response("app/index.html", c, context_instance=RequestContext(request))

Leave a comment