
{% macro render_field(field) %}
    <span {% if field.errors %}class="has-error"{% endif %}>
        {{ field(**kwargs) }}
        {% if field.errors %}
        <span class="help-block">
            {% for error in field.errors %}
            {{ error }}
            {% endfor %}
        </span>
        {% endif %}
    </span>
{% endmacro %}

{% macro render_field_p(field) %}
    <p {% if field.errors %}class="has-error"{% endif %}>
        {{ field.label }}&nbsp;:
        {{ field(**kwargs) }}
        {% if field.errors %}
        <span class="help-block">
            {% for error in field.errors %}
            {{ error }}
            {% endfor %}
        </span>
        {% endif %}
    </p>
{% endmacro %}

{% macro render_field_table(field) %}
    <td {% if field.errors %}class="has-error"{% endif %}>
        {{ field(**kwargs) }}
        {% if field.errors %}
        <span class="help-block">
            {% for error in field.errors %}
            {{ error }}
            {% endfor %}
        </span>
        {% endif %}
    </td>
{% endmacro %}

{% macro render_nav_item(url, title) %}
    <li {% if request.script_root + request.path == url %}class="active"{% endif %}>
        <a class="navbar-link" href="{{ url }}">{{ title }}</a>
    </li>
{% endmacro %}
