3👍
✅
Have you checked the source? It should already be there. The uni_form template tag should include it automatically.
2👍
I’m having the exact same problem with django-uni-form. The csrf token does not show up after the <form>
tag if I use:
{% load uni_form_tags %}
{% uni_form form helper %}
or:
{% load uni_form_tags %}
{% with form.helper as helper %}
{% uni_form form helper%}
{%endwith%}
If I include it manually it works:
<form action='{{ request.path }}' method='POST' class="uniForm">{% csrf_token %}
{{ form|safe }}
</form>
I found a blog post that outlines how to include the csrf token manually:
helper = FormHelper()
csrf_token = Hidden(
name = 'csrfmiddlewaretoken',
value = request.META['CSRF_COOKIE'])
helper.add_input(csrf_token)
Not at all pretty but at least it gets the uni-form to work.
- [Django]-Django design patterns for overriding models
- [Django]-Removing unused lookup_field generated from router on viewset
- [Django]-Filter JSON field django with greater than, less than and a range using _contains
- [Django]-Looking for read-write lock in Django using PostgreSQL, e.g., SELECT FOR SHARE
1👍
The easiest solution is to install django-uni-form from GitHub until the version on PyPi is updated to 0.8.
pip install https://github.com/pydanny/django-uni-form/tarball/master
👤Dave
- [Django]-UnicodeEncodeError raised when 'createsuperuser' is called
- [Django]-To what framework is it worth to switch from django
- [Django]-Using Django's test client, make a request using an in-memory file
Source:stackexchange.com