django crispy forms with jinja2 -
i want use jinja2 , django crispy forms together, when load crispy_forms_tags in template , trying render form template tag, error:
encountered unknown tag 'crispy'. jinja looking following tags: 'endblock'. innermost block needs closed 'block'.
my template code:
{% extends 'base.html' %} {% load crispy_forms_tags %} {% block content %} <div class="panel-heading"><h3>registration</h3></div> {% crispy form %} {% endblock %}
how can use apps together?
better solution:
templatetags.py
from crispy_forms.utils import render_crispy_form django_jinja import library jinja2 import contextfunction @contextfunction @library.global_function def crispy(context, form): return render_crispy_form(form, context=context)
in template:
{{ crispy(form) }}
Comments
Post a Comment