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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -