{% load crispy_forms_field %}
{% load trionyx %}


<{% if tag %}{{ tag }}{% else %}div{% endif %} id="div_{{ field.auto_id }}" {% if not field|is_checkbox %}class="form-group{% else %}class="checkbox{% endif %}{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if form_show_errors%}{% if field.errors %} has-error{% endif %}{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
    {% if field.label and not field|is_checkbox and form_show_labels %}
        <label for="{{ field.id_for_label }}" class="{{ label_class }}{% if field.field.required %} requiredField{% endif %}">
            {{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
        </label>
    {% endif %}

    <div class="input-group date {{ field_class }}">
        <input type="{{ field.input_type }}"
            name="{% if field.name|wordcount > 1 %}{{ field.name|slugify }}{% else %}{{ field.name }}{% endif %}"
            value="{% if field.value|is_date %}{{ field.value|date:input_format }}{% else %}{{ field.value }}{% endif %}"
            id="{{ field.auto_id }}"
            {{ flat_attrs|safe }}
        />
        <span class="input-group-addon">
            <span class="glyphicon {{ glyphicon }}"></span>
        </span>
        {% include 'bootstrap3/layout/help_text_and_errors.html' %}
    </div>
</{% if tag %}{{ tag }}{% else %}div{% endif %}>
