diff --git a/vm_gen/templates/html/_create.html b/vm_gen/templates/html/_create.html index d028ac8..35f7394 100644 --- a/vm_gen/templates/html/_create.html +++ b/vm_gen/templates/html/_create.html @@ -9,7 +9,7 @@ [%- if not column.secondary %] - Choose... + Choose... [%- 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', ] %] + Choose... [%- for value, display in column.choices.items() %] [[ display ]] [%- endfor %] diff --git a/vm_gen/templates/html/_update.html b/vm_gen/templates/html/_update.html index c0da90c..7dfe636 100644 --- a/vm_gen/templates/html/_update.html +++ b/vm_gen/templates/html/_update.html @@ -11,9 +11,9 @@ {%- for sub_instance in model_views.[[ column.name ]].model.query.all() %} {{ sub_instance.name }} + {% if sub_instance in instance.[[ column.name|pluralize ]] %}selected="selected"{% endif %}>{{ sub_instance }} [%- else %] - {% if instance.[[ column.name ]]_id == sub_instance.id %}selected="selected"{% endif %}>{{ sub_instance.name }} + {% if instance.[[ column.name ]]_id == sub_instance.id %}selected="selected"{% endif %}>{{ sub_instance }} [%- endif %] {%- endfor %}