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