Hi there, I'm trying to get to the bottom of this warning that I am getting:
/usr/local/lib/python2.7/site-packages/django/template/defaulttags.py:59: UserWarning: A {% csrf_token %} was used in a template, but the context did not provide the value. This is usually caused by not using RequestContext. warnings.warn("A {% csrf_token %} was used in a template, but the context did not provide the value. This is usually caused by not using RequestContext.") My setup is that I have a form that I am passing to my views via AJAX. I prepare the AJAX POST following the guidelines at: https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ajax I am then returning the response using: return HttpResponse(json.dumps(data), content_type="application/json") The data returned in the response is then used to update the template that also includes the form. >From the warning I guess I am not returning the CSRF token in the response? Is that the issue? I did try adding the @ensure_csrf_cookie decorator to the views function but still got this warning. Should I manually return a RequestContext and modify my javascript to handle the token accordingly? Apologies - it's the first time I've done anything like this... Many thanks for any help or light anyone can shed on this. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/26e4e778-5dbd-45ed-86ea-353f02dc9016%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.