25 lines
1.1 KiB
HTML
25 lines
1.1 KiB
HTML
{% macro render_field(field, disabled_fields=[], exclude_fields=[]) %}
|
|
{% set disabled = field.name in disabled_fields %}
|
|
{% set exclude_fields = exclude_fields + ['csrf_token', 'submit'] %}
|
|
{% if field.name not in exclude_fields %}
|
|
{% if field.type == 'BooleanField' %}
|
|
<div class="form-check">
|
|
{{ field(class="form-check-input", type="checkbox", id="flexSwitchCheckDefault") }}
|
|
{{ field.label(class="form-check-label", for="flexSwitchCheckDefault", disabled=disabled) }}
|
|
</div>
|
|
{% else %}
|
|
<div class="form-group">
|
|
{{ field.label(class="form-label") }}
|
|
{{ field(class="form-control", disabled=disabled) }}
|
|
{% if field.errors %}
|
|
<div class="invalid-feedback">
|
|
{% for error in field.errors %}
|
|
{{ error }}
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endmacro %}
|