{% extends "skaffold_layout.html" %}
{% macro with_errors(field) %}
    <div class="field">

    {% if field.errors %}
        {% set css_class = 'has_error ' + kwargs.pop('class', '') %}
        {{ field.label }}{{ field(class=css_class, **kwargs) }}
        <ul class="errors">{% for error in field.errors %}<li>{{ error|e }}</li>{% endfor %}</ul>
    {% else %}
        {{ field.label }}{{ field(**kwargs) }}
    {% endif %}
    </div>
{% endmacro %}

{% block body %}
<form action="{{url_for("admin_%s.save"%model_name, id=unit.id)}}" method="POST">
{{form.csrf_token}}
{% for field in form %}
{% if not field.name == "csrf_token" %}
{{ with_errors(field) }}
{% endif %}
{% endfor %}
<input type="submit">
</form>

{% endblock %}
