csrf_token is not being set when using Jinja2

248 views
Skip to first unread message

Chen Xu

unread,
Jan 18, 2014, 8:11:26 PM1/18/14
to django...@googlegroups.com
Hi everyone,
I am using Jinja2 instead of Django's own template engine, however I am having an issue where csrf_token is empty, I included the following line in my form:

<input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}">

But csrf_token has no value.

Can someone help?


Thanks in advance


--
⚡ Chen Xu

Mario Gudelj

unread,
Jan 18, 2014, 8:57:18 PM1/18/14
to django...@googlegroups.com

Try {% csrf_token %} by itself

--
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...@googlegroups.com.
To post to this group, send email to django...@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/CACac-qZ%3D6CT6yO48dQKEDX%3DuhCZ%2BXzrHraNa1qru2H%2BbCTP5rA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Chen Xu

unread,
Jan 18, 2014, 9:04:22 PM1/18/14
to django...@googlegroups.com
That gives me :

Encountered unknown tag 'csrf_token'.


Thanks




For more options, visit https://groups.google.com/groups/opt_out.



--
⚡ Chen Xu
Reply all
Reply to author
Forward
0 new messages