- Author:
- Reustle
- Posted:
- July 31, 2010
- Language:
- HTML/template
- Version:
- 1.2
- Score:
- 0 (after 0 ratings)
If you currently use {% csrf_token %}
, you will notice it prints a hidden div, and an xHTML input tag. What if you don't want that hidden div, and/or you want your page to validate with HTML and not xHTML.
This snippet returns only the csrf token itself, and none of the related HTML code. You can use it like this.
<input type="hidden" name="csrfmiddlewaretoken" value="{% with csrf_token as csrf_token_clean %}{{ csrf_token_clean }}{% endwith %}" >
1 | {% with csrf_token as csrf_token_clean %}{{ csrf_token_clean }}{% endwith %}
|
More like this
- Bootstrap Accordian by Netplay4 5 years, 11 months ago
- Bootstrap theme for django-endless-pagination? by se210 8 years, 11 months ago
- Bootstrap theme for django-endless-pagination? by se210 8 years, 11 months ago
- Reusable form template with generic view by roldandvg 9 years ago
- Pagination Django with Boostrap by guilegarcia 9 years, 1 month ago
Comments
Or you can use
{{ csrf_token }}
instead.#
Please login first before commenting.