49 lines
2.2 KiB
HTML
49 lines
2.2 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block content %}
|
|
<form method="post">
|
|
{% for model_field in view_model.fields -%}
|
|
<div class="field">
|
|
<label for="{{ model_field.field_name }}">
|
|
{{ model_field.field_name | split(pat="_") | join(sep=" ") | title }}
|
|
</label>
|
|
{% if model_field.select_list != "" %}
|
|
<div class="control">
|
|
<div class="select {% if model.errors | get(key=model_field.field_name, default="" ) !="" %}is-danger{% endif %}">
|
|
<select name="{{ model_field.field_name }}">
|
|
{% if model_field.is_option %}
|
|
<option value=""></option>
|
|
{% else %}
|
|
<option value="" selected disabled>Select</option>
|
|
{% endif %}
|
|
{% for select_list_item in select_lists[model_field.field_name] -%}
|
|
<option {% if select_list_item[0]==model.values | get(key=model_field.field_name, default="" ) %}
|
|
selected {% endif %} value="{{ select_list_item[0] }}">{{ select_list_item[1] | split(pat="_") |
|
|
join(sep=" ") | title }}</option>
|
|
{%- endfor %}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
{% else %}
|
|
<div class="control">
|
|
<input class="input {% if model.errors | get(key=model_field.field_name,default="" ) !="" %}is-danger{% endif %}"
|
|
type="{{ model_field.html_input_type }}"
|
|
value="{{ model.values | get(key=model_field.field_name, default="") | split(pat=" _") | join(sep=" " ) | title }}"
|
|
name="{{ model_field.field_name }}"
|
|
placeholder="{{ model_field.field_name }}"
|
|
aria-label="{{ model_field.field_name }}"
|
|
>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
{%- endfor %}
|
|
<div class="field is-grouped">
|
|
<div class="control">
|
|
<button class="button is-link" type="submit">Save</button>
|
|
</div>
|
|
<div class="control">
|
|
<a class="button is-link is-light" href="{{ list_link }}">Cancel</a>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
{% endblock content %} |