[Answer]-Why am i getting a csrf error in my POST form? (django/python)

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/

  1. 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.

  2. 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))

Leave a comment