update create and update
This commit is contained in:
parent
ac6eb101b5
commit
c145eb7319
@ -9,7 +9,7 @@
|
||||
<select id="input-[[ name|camel_to_snake ]]-[[ column.name ]]" [% if column.multiple %]multiple
|
||||
name="_m_n_[[ column.name|pluralize ]]"[% else %]name="[[ column.name ]]_id"[%- endif %]>
|
||||
[%- if not column.secondary %]
|
||||
<option selected="selected">Choose...</option>
|
||||
<option selected="selected" value="">Choose...</option>
|
||||
[%- endif %]
|
||||
{% if instance.[[ column.name|pluralize ]] is not defined %}
|
||||
{% set [[ column.name|pluralize ]] = model_views.[[ column.name ]].model.query.all() %}
|
||||
@ -23,6 +23,7 @@
|
||||
[%- elif column.type in ['choice', ] %]
|
||||
<select id="input-[[ name|camel_to_snake ]]-[[ column.name ]]"
|
||||
name="[[ column.name ]]_id">
|
||||
<option selected="selected" value="">Choose...</option>
|
||||
[%- for value, display in column.choices.items() %]
|
||||
<option value="[[ value ]]" {% if instance and instance.[[ column.name ]] == "[[ value ]]" %}selected="selected"{% endif %}>[[ display ]]</option>
|
||||
[%- endfor %]
|
||||
|
@ -11,9 +11,9 @@
|
||||
{%- for sub_instance in model_views.[[ column.name ]].model.query.all() %}
|
||||
<option value="{{ sub_instance.id }}"
|
||||
[%- if column.multiple %]
|
||||
{% if sub_instance in instance.[[ column.name|pluralize ]] %}selected="selected"{% endif %}>{{ sub_instance.name }}</option>
|
||||
{% if sub_instance in instance.[[ column.name|pluralize ]] %}selected="selected"{% endif %}>{{ sub_instance }}</option>
|
||||
[%- else %]
|
||||
{% if instance.[[ column.name ]]_id == sub_instance.id %}selected="selected"{% endif %}>{{ sub_instance.name }}</option>
|
||||
{% if instance.[[ column.name ]]_id == sub_instance.id %}selected="selected"{% endif %}>{{ sub_instance }}</option>
|
||||
[%- endif %]
|
||||
{%- endfor %}
|
||||
</select>
|
||||
|
Loading…
Reference in New Issue
Block a user