{% load i18n %}
<div class="form-group{% if field.field.required %} mandatory{% endif %}{% if field.errors %} is-invalid{% endif %}{% if extra_class %} {{ extra_class }}{% endif %}">
    {% if not hide_label and not field.is_hidden %}
        {% if field.field.widget.input_type != "checkbox" or field.field.widget.allow_multiple_selected %}
            <label for="{{ field.auto_id }}" class="form-label">{{ field.label }}</label>
        {% endif %}
    {% endif %}
    {% if field.use_fieldset %}
        <fieldset {% if field.help_text and field.auto_id and "aria-describedby" not in field.field.widget.attrs %} aria-describedby="{{ field.auto_id }}_helptext"{% endif %}>
        {% endif %}
        {{ field }}
        {% if field.field.widget.input_type == "checkbox" and not field.field.widget.allow_multiple_selected and not field.is_hidden %}
            <label for="{{ field.auto_id }}" class="form-check-label form-label">{{ field.label }}</label>
        {% endif %}
        {% if field.use_fieldset %}</fieldset>{% endif %}
    {% for text in field.errors %}<div class="invalid-feedback">{{ text }}</div>{% endfor %}
    {% if field.help_text and not field.is_hidden and not field.field.widget.input_type == "hidden" %}
        <small class="form-text text-muted"
               {% if field.auto_id %}id="{{ field.auto_id }}_helptext"{% endif %}>{{ field.help_text|safe }}</small>
    {% endif %}
</div>
