40 lines
1.3 KiB
HTML
40 lines
1.3 KiB
HTML
<form method="POST">
|
|
{% macro render_row(row) %}
|
|
<!-- {{ row.name }} -->
|
|
{% if row.fields or row.children or row.legend %}
|
|
{% if row.legend %}<legend>{{ row.legend }}</legend>{% endif %}
|
|
<fieldset
|
|
{% if row.attrs %}{% for k,v in row.attrs.items() %}
|
|
{{k}}{% if v is not sameas true %}="{{ v }}"{% endif %}
|
|
{% endfor %}{% endif %}>
|
|
{% for field in row.fields %}
|
|
<div
|
|
{% if field.wrap %}{% for k,v in field.wrap.items() %}
|
|
{{k}}{% if v is not sameas true %}="{{ v }}"{% endif %}
|
|
{% endfor %}{% endif %}>
|
|
{{ render_field(field, values.get(field.name, '')) | safe }}
|
|
</div>
|
|
{% endfor %}
|
|
{% for child in row.children %}
|
|
{{ render_row(child) }}
|
|
{% endfor %}
|
|
</fieldset>
|
|
{% endif %}
|
|
{% endmacro %}
|
|
|
|
{% if rows %}
|
|
{% for row in rows %}
|
|
{{ render_row(row) }}
|
|
{% endfor %}
|
|
{% else %}
|
|
{% for field in fields %}
|
|
{{ render_field(field, values.get(field.name, '')) | safe }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
|
|
<button type="submit"
|
|
{% if submit_attrs %}{% for k,v in submit_attrs.items() %}
|
|
{{k}}{% if v is not sameas true %}="{{ v }}"{% endif %}
|
|
{% endfor %}{% endif %}
|
|
>{{ submit_label if label else 'Save' }}</button>
|
|
</form>
|