UnderCover/undercover/templates/_formhelpers.jinja2

25 lines
519 B
Django/Jinja

{% macro render_label(field) %}
<dt>{{ field.label }}</dt>
{% endmacro %}
{% macro render_input(field, extra="") %}
<dd {{extra}}>
{{ field(**kwargs)|safe }}
{% if field.errors %}
<ul class=errors>
{% for error in field.errors %}
<li>{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
</dd>
{% endmacro %}
{% macro render_field(field, extra="") %}
<div class="field">
{{ render_label(field) }}
{{ render_input(field, extra, **kwargs) }}
</div>
{% endmacro %}