views.py
from django.core.context_processors import csrf
context.update(csrf(request))
{'csrf_token': <django.utils.functional.__proxy__ object at 0xae0f4ec>}
I am trying to add csrf token to my forms.i m generating csrf token in the views like above.But csrf_token value gives some proxy object like the one shown above instead of string.I m using django 1.3.Thanks in advance for any sort of help.
The csrf method is lazy, it returns a Promise/Proxy. Once this object is called in the template, the template engine will unicode this object which triggers the real method.
Try this:
print unicode(csrf(request)['csrf_token'])