jane
jane

Reputation: 1

html, csrf token tag is not working. Shows in page

I'm using django and a static html file.

i add {% csrf_token %} tag in my html.

<form data-toggle="validator" role="form" action="/form/" method="post">

            {% csrf_token %}
            <!some inputs>
</form>

But when i refresh the page there is a text above my form {% csrf_token %} Why html tag is not working?

Upvotes: 0

Views: 1018

Answers (1)

mishbah
mishbah

Reputation: 5607

Another option is to use JavaScript to get csrf token:

https://docs.djangoproject.com/en/dev/ref/csrf/#ajax

Upvotes: 1

Related Questions