Login

Tag "csrf_token_clean"

Snippet List

Django csrf_token Template Tag Fix

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 %}" >`

  • csrf_token
  • csrf_token_clean
Read More

1 snippet posted so far.