wundertile/app/templates/macros/quick_form.html

26 lines
661 B
HTML
Raw Permalink Normal View History

2019-04-24 17:51:45 +02:00
{# macro file for printing forms #}
{% macro quick_form(form, dest, autofocus=True) %}
<form action="{{ dest }}" method="post">
{% for item in form if not item.label.text == "CSRF Token" %}
{{ item.label }}
{% if loop.first and autofocus %}
{{ item(autofocus=True) }}
{% else %}
{{ item }}
{% endif %}
{% endfor %}
{{ form.csrf_token }}
<input type="submit" value="Submit">
</form>
{% for field in form.errors %}
{% for error in form.errors[field] %}
<div class="alert alert-error">
<p><strong>Error in the field {{ form[field].label.text }}!</strong> {{error}}</p>
</div>
{% endfor %}
{% endfor %}
{% endmacro %}