File: field.html

package info (click to toggle)
python-django-crispy-forms 1.14.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,676 kB
  • sloc: python: 4,025; makefile: 92; sh: 16
file content (36 lines) | stat: -rw-r--r-- 1,871 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{% load crispy_forms_field %}

{% if field.is_hidden %}
    {{ field }}
{% else %}
    <{% if tag %}{{ tag }}{% else %}div{% endif %} id="div_{{ field.auto_id }}" class="control-group{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if form_show_errors%}{% if field.errors %} 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="control-label {% if field.field.required %}requiredField{% endif %}">
                {{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
            </label>
        {% endif %}

        {% if field|is_checkboxselectmultiple %}
            {% include 'bootstrap/layout/checkboxselectmultiple.html' %}
        {% endif %}

        {% if field|is_radioselect %}
            {% include 'bootstrap/layout/radioselect.html' %}
        {% endif %}

        {% if not field|is_checkboxselectmultiple and not field|is_radioselect %}
            <div class="controls">
                {% if field|is_checkbox and form_show_labels %}
                    <label for="{{ field.id_for_label }}" class="checkbox {% if field.field.required %}requiredField{% endif %}">
                        {% crispy_field field %}
                        {{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
                    </label>
                    {% include 'bootstrap/layout/help_text_and_errors.html' %}
                {% else %}
                    {% crispy_field field %}
                    {% include 'bootstrap/layout/help_text_and_errors.html' %}
                {% endif %}
            </div>
        {% endif %}
    </{% if tag %}{{ tag }}{% else %}div{% endif %}>
{% endif %}