1π
You have to go and edit django.template.defaulttags.py: At line 48 there is the output of the tag, and you may change it as you wish.
Please note that this is a development feature, and as such, subject to change β updating Django will likely remove your change!.
Also, please take the time to go look for a ticket about this particular problem: the solution I proposed will likely fix your problem, but I think that an βofficialβ fix would be a lot nicer.
3π
Here is my fix to the problem.
{% with csrf_token as csrf_token_clean %}{{ csrf_token_clean }}{% endwith %}
In your template, this will return only the token key, so you can write your own valid HTML input tag, like this.
<input type="hidden" name="csrfmiddlewaretoken" value="{% with csrf_token as csrf_token_clean %}{{ csrf_token_clean }}{% endwith %}" >
Source: http://www.phptodjango.com/2010/07/django-csrftoken-template-tag-fix.html
- [Django]-Nodeenv throws no python virtualenv is available
- [Django]-Pyapns Fault 500: 'Connection to the APNS server could not be made
- [Django]-Can't upload image in django use MEDIA_ROOT and MEDIA_URL
3π
The solution is actually very simple:
<input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}">
There is no point in {% with %}
construct.
- [Django]-Graphene-Django nested filters (relay)
- [Django]-Django querying on range of days with timezone.now and __range broken?
- [Django]-How can I include user profile's images/logos on django comments
- [Django]-Saving to database in Django tests when using ThreadPoolExecutor
- [Django]-Creating custom list filter in django