Source du gabarit : frags/form_inputs.html

{% load widget_tweaks %}
{% load i18n %}

{% with input_class|add:" input--error" as error_classes %}
    {% if form_input.errors %}
        <label class="form__label form__label--error" for="{{form_input.id_for_label}}">
          {{input_label}}
        </label>
        {% render_field form_input class=error_classes placeholder=input_placeholder autofocus="false" %}
        <div class="input__error input__error--small">
            {% for error in form_input.errors %}
                {{error|escape}}
            {% endfor %}
        </div>
    {% else %}
        <label class="form__label" for="{{form_input.id_for_label}}">
          {{input_label}}
        </label>
        {% if not readonly %}
        {% render_field form_input class=input_class placeholder=input_placeholder autofocus="false" %}
        {% else %}
        {% render_field form_input class=input_class placeholder=input_placeholder autofocus="false" readonly="true" %}
        {% endif %}
    {% endif %}
{% endwith %}