File: radio_checkbox_select.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 (27 lines) | stat: -rw-r--r-- 1,268 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
27
{% load crispy_forms_filters %}
{% load l10n %}

<div {% if field_class %}class="{{ field_class }}"{% endif %}{% if flat_attrs %} {{ flat_attrs }}{% endif %}>

    {% for group, options, index in field|optgroups %}
    {% if group %}<strong>{{ group }}</strong>{% endif %}
    {% for option in options %}
      <div class="form-check{% if inline_class %} form-check-inline{% endif %}">
        <input type="{{option.type}}" class="form-check-input{% if field.errors %} is-invalid{% endif %}"  name="{{ field.html_name }}" value="{{ option.value|unlocalize }}" {% include "bootstrap5/layout/attrs.html" with widget=option %}>
        <label for="{{ option.attrs.id }}" class="form-check-label">
            {{ option.label|unlocalize }}
        </label>
        {% if field.errors and forloop.last and not inline_class and forloop.parentloop.last %}
            {% include 'bootstrap5/layout/field_errors_block.html' %}
        {% endif %}
     </div>
    {% endfor %}
    {% endfor %}

</div>
{% if field.errors and inline_class %}
    {% for error in field.errors %}
        <p id="error_{{ forloop.counter }}_{{ field.auto_id }}" class="invalid-feedback"><strong>{{ error }}</strong></p>
    {% endfor %}
{% endif %}
{% include 'bootstrap5/layout/help_text.html' %}