2022-05-31 23:13:44 +02:00
|
|
|
{% extends "base.html" %}
|
|
|
|
|
|
|
|
{% block content %}
|
2022-10-07 21:32:59 +02:00
|
|
|
<form hx-boost="true" hx-indicator="#loading" hx-push-url="true" hx-encoding="multipart/form-data" method="post" enctype="multipart/form-data">
|
2022-08-04 09:21:40 +02:00
|
|
|
{% for model_field in view_model.fields -%}
|
|
|
|
<div class="field">
|
2022-08-04 17:44:40 +02:00
|
|
|
<label class="{{ model_field | get_html_input_type }}" for="{{ model_field.field_name }}">
|
2022-08-20 22:51:15 +02:00
|
|
|
{{ model_field.field_name | split(pat="_") | join(sep=" ") | title }}{% if not model_field.is_option %} *{% endif %}
|
2022-08-04 09:21:40 +02:00
|
|
|
</label>
|
|
|
|
<div class="control">
|
2022-08-05 18:23:51 +02:00
|
|
|
{% if model_field.field_type == "SelectList" %}
|
|
|
|
{% include "form_elements/selectlist.html" %}
|
|
|
|
{% elif model_field.field_type == "Checkbox" %}
|
|
|
|
{% include "form_elements/checkbox.html" %}
|
2022-08-04 09:21:40 +02:00
|
|
|
{% else %}
|
2022-08-05 18:23:51 +02:00
|
|
|
{% include "form_elements/input.html" %}
|
2022-08-04 09:21:40 +02:00
|
|
|
{% endif %}
|
2022-08-05 18:23:51 +02:00
|
|
|
</div>
|
2022-08-20 22:51:15 +02:00
|
|
|
{% if model.errors | get(key=model_field.field_name, default="" ) !="" %}
|
|
|
|
<p class="help is-danger">{{ model.errors | get(key=model_field.field_name) }}</p>
|
|
|
|
{% endif %}
|
|
|
|
{% if model.custom_errors | get(key=model_field.field_name, default="" ) !="" %}
|
|
|
|
<p class="help is-danger">{{ model.custom_errors | get(key=model_field.field_name) }}</p>
|
|
|
|
{% endif %}
|
2022-08-04 09:21:40 +02:00
|
|
|
</div>
|
|
|
|
{%- endfor %}
|
|
|
|
<div class="field is-grouped">
|
|
|
|
<div class="control">
|
2022-10-06 15:08:00 +02:00
|
|
|
<button class="button is-link" type="submit">Save</i></button>
|
2022-08-04 09:21:40 +02:00
|
|
|
</div>
|
|
|
|
<div class="control">
|
|
|
|
<a class="button is-link is-light" href="{{ list_link }}">Cancel</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
2022-05-31 23:13:44 +02:00
|
|
|
{% endblock content %}
|