oshipka/vm_gen/templates/html/_create.html

24 lines
1.3 KiB
HTML
Raw Normal View History

2020-06-04 18:02:34 +02:00
<form action="{{ url_for('create_[[ name|camel_to_snake ]]') }}" method="post">
<input type="hidden" name="_next" value="{{ _next or request.args.get('_next') or url_for('list_[[ name|camel_to_snake ]]') }}"/>
2020-06-04 18:02:34 +02:00
[%- for column in columns %]
2020-06-06 13:33:39 +02:00
<label for="input-[[ name|camel_to_snake ]]-[[ column.name ]]">[[ column.name ]]</label>:
[%- if column.type in ['relationship'] %]
2020-06-07 20:29:51 +02:00
<select id="input-[[ name|camel_to_snake ]]-[[ column.name ]]" [%- if column.secondary %]multiple[%- endif %]
2020-06-07 13:13:14 +02:00
name="[[ column.name ]]_id">
<option selected="selected">Choose...</option>
{%- for sub_instance in model_views.[[ column.name ]].model.query.all() %}
<option value="{{ sub_instance.id }}" {% if instance and instance.id == sub_instance.id %}selected="selected"{% endif %}>{{ sub_instance.name }}</option>
2020-06-07 13:13:14 +02:00
{%- endfor %}
</select>
[%- elif column.type in ['number', 'int', 'integer', ] %]
<input id="input-[[ name|camel_to_snake ]]-[[ column.name ]]"
type="number" name="[[ column.name ]]"
/>
2020-06-06 13:33:39 +02:00
[%- else %]
<input id="input-[[ name|camel_to_snake ]]-[[ column.name ]]"
type="text" name="[[ column.name ]]" autocomplete="off"
/>
[%- endif %]
2020-06-04 18:02:34 +02:00
[%- endfor %]
<input type="submit">
</form>