summaryrefslogtreecommitdiff
path: root/templates/base/form_field.html
blob: 70ce28403da91bcd160177a8e63fb2f2cf27af71 (plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{%load pgfilters%}
    {% if field.is_hidden %}
      {{ field }}
    {% else %}{# not field.is_hidden #}
      {% if not field|ischeckbox %}
        <div class="form-group">
          {{field|label_class:"control-label col-lg-12"}}
          <div class="col-lg-12 controls">
            {% if field.errors %}
              {% for e in field.errors %}
                <div class="alert alert-danger">{{e}}</div>
              {% endfor %}
            {% endif %}
            {{field|field_class:"form-control"}}
            {%if field.help_text%}
              <small>{{field.help_text|safe}}</small>
            {%endif%}
          </div>
        </div>
      {% else %}{# field|ischeckbox #}
        <div class="form-group">
          <div class="col-lg-12 {%if field|isrequired_error%} alert alert-danger{%endif%}">
            {% if not field|ismultiplecheckboxes %}
              <div class="form-check">
                {{ field }}
                <label for="{{ field.id_for_label }}" class="form-check-label">
                  {{ field.label }}
                </label>
                {%if field.help_text%}
                  <small class="form-text text-muted">{{field.help_text|safe}}</small>
                {%endif%}
              </div>
            {% else %}
              {{ field.label_tag }}
	      {%if field.help_text%}<small class="form-text">{{field.help_text|safe}}</small>{%endif%}
              {% for cb in field %}
                <div class="form-check">
                  {{ cb.tag }}
                  <label for="{{ cb.id_for_label }}" class="form-check-label">{{ cb.choice_label }}</label>
{%if described_checkboxes|dictlookup:field.name%}

		  <div class="describedcheckbox">{{described_checkboxes|dictlookup:field.name|dictlookup:cb.data.value}}</div>
{%endif%}
                </div>
              {% endfor %}
            {% endif %}
          </div>
          {% if field.errors and not field|isrequired_error %}
            {% for e in field.errors %}
              <div class="alert alert-danger">{{e}}</div>
            {% endfor %}
          {% endif %}
        </div>
      {% endif %}
    {% endif %}