{% load materializecss %}


    {% if field|is_checkbox %}
    <div class="col {{ classes.label }}">
        <div class="{{ classes.single_value }}">
            <div class="checkbox">
                {% if field.auto_id %}
                    <label {% if field.field.required and form.required_css_class %}class="{{ form.required_css_class }}"{% endif %}>
                        {{ field }} <span>{{ field.label }}</span>
                    </label>
                {% endif %}
                {% for error in field.errors %}
                    <span class="help-block {{ form.error_css_class }}">{{ error }}</span>
                {% endfor %}

                {% if field.help_text %}
                    <p class="help-block">
                        {{ field.help_text|safe }}
                    </p>
                {% endif %}
            </div>
        </div>
    </div>
    {% elif field|is_radio %}
    <div class="col {{ classes.label }}">

        {% if field.auto_id %}
            <label class="control-label {{ classes.label }} {% if field.field.required %}{{ form.required_css_class }}{% endif %}">{{ field.label }}</label>
        {% endif %}
        <div class="{{ classes.value }}">
            {% for choice in field %}
                  <p>
                    {{ choice.tag }}
                    <label for="{{ choice.id_for_label }}">{{ choice.choice_label }}</label>
                  </p>
            {% endfor %}

            {% for error in field.errors %}
                <span class="help-block {{ form.error_css_class }}">{{ error }}</span>
            {% endfor %}

            {% if field.help_text %}
            <p class="help-block">
                {{ field.help_text|safe }}
            </p>
            {% endif %}
        </div>
    </div>
    {% elif field|is_date_input %}
    <div class="col {{ classes.label }}">

        <label for="{{ field.id_for_label }}">{{ field.label }}</label>
        <input type="date" id="{{ field.id }}" class="datepicker" value="{% if field.value %}{{ field.value }}{% endif %}">

            {% for error in field.errors %}
                <span class="help-block {{ form.error_css_class }}">{{ error }}</span>
            {% endfor %}

            {% if field.help_text %}
            <p class="help-block">
                {{ field.help_text|safe }}
            </p>
            {% endif %}
    </div>
    {% elif field|is_select %}
    <div class="col {{ classes.label }}">
            {% if field|is_checkbox_select_multiple %}
                {% if field.auto_id %}
                    <label class="control-label {{ classes.label }} {% if field.field.required %}{{ form.required_css_class }}{% endif %}">{{ field.label }}</label>
                {% endif %}
                <div class="{{ classes.value }}">
                    {% for choice in field %}
                          <p>
                            {{ choice.tag }}
                            <label for="{{ choice.id_for_label }}">{{ choice.choice_label }}</label>
                          </p>
                    {% endfor %}

                    {% for error in field.errors %}
                        <span class="help-block {{ form.error_css_class }}">{{ error }}</span>
                    {% endfor %}

                    {% if field.help_text %}
                    <p class="help-block">
                        {{ field.help_text|safe }}
                    </p>
                    {% endif %}
                </div>

            {% else %}
                <label for="{{ field.id_for_label }}">{{ field.label }}</label>
                {{field}}
                {% for error in field.errors %}
                    <span class="help-block {{ form.error_css_class }}">{{ error }}</span>
                {% endfor %}

                {% if field.help_text %}
                <p class="help-block">
                    {{ field.help_text|safe }}
                </p>
                {% endif %}

                {% endif %}

    </div>

    {% elif field|is_textarea %}
        <div class="input-field col {{ classes.label }}">
            <textarea id="{{ field.id }}" class="materialize-textarea">{% if field.value %}{{ field.value }}{% endif %}</textarea>
            {% if field.auto_id %}
                <label class="{{ classes.label }} {% if field.field.required %}{{ form.required_css_class }}{% endif %}" for="{{ field.auto_id }}">{{ field.label }}</label>
            {% endif %}

            {% for error in field.errors %}
                <p class="help-block orange-text {{ form.error_css_class }}">{{ error }}</p>
                {% endfor %}

            {% if field.help_text %}
                <p>
                    {{ field.help_text|safe }}
                </p>
            {% endif %}
        </div>

    {% elif field|is_file %}
        <div class="col {{ classes.label }}">
            <p>
            {% if field.auto_id %}
                <label class="{{ classes.label }} {% if field.field.required %}{{ form.required_css_class }}{% endif %}" for="{{ field.auto_id }}">{{ field.label }}</label><br>
            {% endif %}
            {{ field }}
            </p>

            {% for error in field.errors %}
                <p class="help-block orange-text {{ form.error_css_class }}">{{ error }}</p>
                {% endfor %}

            {% if field.help_text %}
                <p>
                    {{ field.help_text|safe }}
                </p>
            {% endif %}
        </div>  
    {% else %}

        <div class="input-field col {{ classes.label }}">
            {{ field }}
            {% if field.auto_id %}
                <label class="{{ classes.label }} {% if field.field.required %}{{ form.required_css_class }}{% endif %}" for="{{ field.auto_id }}">{{ field.label }}</label>
            {% endif %}

            {% for error in field.errors %}
                <p class="help-block orange-text {{ form.error_css_class }}">{{ error }}</p>
                {% endfor %}

            {% if field.help_text %}
                <p>
                    {{ field.help_text|safe }}
                </p>
            {% endif %}
        </div>

    {% endif %}
