Hi, you have to include the request context to use CSRF token.
from django.template import RequestContext return render_to_response('index.html', locals(), context_instance = RequestContext(request)) Greeting, Ilian Iliev On Thu, Dec 9, 2010 at 2:08 AM, martvefun <martve...@gmail.com> wrote: > Hello, > > I've a login form which give me an CSRF error. > In the documentation, I read that I needed to have in my code : > > # views.py > ... > csrf_token = {} > csrf_token.update(csrf(request)) > return render_to_response('index.html', locals()) > > # index.html > ... > <form action="" method="post"> > {% csrf_token %} > > But I've an error that the two tokens are different > I guess the problem is in the generation of the token : > > <form action="" method="post"> > <div style='display:none'><input type='hidden' > name='csrfmiddlewaretoken' value='{'csrf_token': > <django.utils.functional.__proxy__ object at 0x88b1d0c>}' /></div> > > > It should use value="{'csrf_.... instead of value='{'csrf._.. > > Any idea how to fix ? > > Thanks > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- eng. Ilian Iliev Web Software Developer Mobile: +359 88 66 08 400 Website: ilian.i-n-i.org -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.