File: inline_field.html

package info (click to toggle)
python-crispy-bootstrap5 2024.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 664 kB
  • sloc: python: 1,949; sh: 6; makefile: 3
file content (26 lines) | stat: -rw-r--r-- 1,034 bytes parent folder | download
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
{% load crispy_forms_field %}

{% if field.is_hidden %}
    {{ field }}
{% else %}
    {% if field|is_checkbox %}
        <div id="div_{{ field.auto_id }}" class="form-check form-check-inline{% if wrapper_class %} {{ wrapper_class }}{% endif %}">
            {% crispy_field field 'class' 'form-check-input' %}
            <label for="{{ field.id_for_label }}" class="form-check-label">
                {{ field.label }}
            </label>
        </div>
    {% else %}
        <div id="div_{{ field.auto_id }}"{% if wrapper_class %} class="{{ wrapper_class }}"{% endif %}>
            <label for="{{ field.id_for_label }}" class="visually-hidden">
                {{ field.label }}
            </label>
            {% if field.errors %}
                {% crispy_field field 'class' 'form-control is-invalid' 'placeholder' field.label %}
            {% else %}
                {% crispy_field field 'class' 'form-control' 'placeholder' field.label %}
            {% endif %}
            
        </div>
    {% endif %}
{% endif %}