fieldset.html 1.8 KB

123456789101112131415161718192021222324252627282930
  1. {% load jet_tags %}
  2. <fieldset class="module aligned {{ fieldset.classes }}">
  3. {% if fieldset.name %}<h2>{{ fieldset.name }}</h2>{% endif %}
  4. {% if fieldset.description %}
  5. <div class="description">{{ fieldset.description|safe }}</div>
  6. {% endif %}
  7. {% for line in fieldset %}
  8. <div class="form-row{% if line.fields|length_is:'1' and line.errors %} errors{% endif %}{% if line.has_visible_field == False %} hidden{% endif %}{% for field in line %}{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% endfor %}">
  9. {% if line.fields|length_is:'1' %}{{ line.errors }}{% endif %}
  10. {% for field in line %}
  11. <div{% if not line.fields|length_is:'1' %} class="field-box{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% if not field.is_readonly and field.errors %} errors{% endif %}{% if field.field.is_hidden %} hidden{% endif %}"{% elif field.is_checkbox %} class="checkbox-row"{% endif %}>
  12. {% if not line.fields|length_is:'1' and not field.is_readonly %}{{ field.errors }}{% endif %}
  13. {% if field.is_checkbox %}
  14. {{ field.field }}{{ field.label_tag }}
  15. {% else %}
  16. {{ field.label_tag }}
  17. {% if field.is_readonly %}
  18. <p>{{ field.contents }}</p>
  19. {% else %}
  20. {{ field.field|jet_select2_lookups }}
  21. {% endif %}
  22. {% endif %}
  23. {% if field.field.help_text %}
  24. <p class="help">{{ field.field.help_text|safe }}</p>
  25. {% endif %}
  26. </div>
  27. {% endfor %}
  28. </div>
  29. {% endfor %}
  30. </fieldset>