File: multifield.html

package info (click to toggle)
python-crispy-bootstrap3 2024.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 500 kB
  • sloc: python: 1,815; makefile: 3
file content (39 lines) | stat: -rw-r--r-- 1,365 bytes parent folder | download | duplicates (2)
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
37
38
39
{% load crispy_forms_field %}

{% if field.is_hidden %}
    {{ field }}
{% else %}

    {% if field|is_checkbox %}
        {% if field.errors %}<div class="has-error">{% endif %}
        <div class="checkbox">
            {% if field.label %}
                <label for="{{ field.id_for_label }}"{% if labelclass %} class="{{ labelclass }}"{% endif %}>
            {% endif %}
            
            {% crispy_field field %}
            {{ field.label }}
            
            {% if field.label %}
                </label>
            {% endif %}
            {% if field.help_text %}
                <span id="help_{{ field.auto_id }}" class="help-block">{{ field.help_text|safe }}</span>
            {% endif %}
        </div>
        {% if field.errors %}</div>{% endif %}
    {% else %}
        <div class="form-group {% if field.errors %}has-error{% endif %}">
            {% if field.label %}
                <label class="control-label" for="{{ field.id_for_label }}"{% if labelclass %} class="{{ labelclass }}"{% endif %}>
                {{ field.label }}
                </label>
            {% endif %}
            {% crispy_field field %}
            {% if field.help_text %}
                <span id="help_{{ field.auto_id }}" class="help-block">{{ field.help_text|safe }}</span>
            {% endif %}
        </div>
    {% endif %}

{% endif %}