add old flash to realtion create

This commit is contained in:
2021-02-11 21:57:23 +01:00
parent d43ddfa8bd
commit 780ad36696
3 changed files with 22 additions and 10 deletions
@@ -13,8 +13,6 @@ Define property
{# The parent can be either object or relation model #}
<h1>Add new property to {{object.describe}}</h1>
{# TODO implement value restoration on error #}
<form action="/model/property/create" method="POST">
<input type="hidden" name="object" value="{{object.id}}">
@@ -12,28 +12,26 @@ Define relation
<h1>Define new relation from "{{object.name}}"</h1>
{# TODO implement value restoration on error #}
<form action="/model/relation/create" method="POST">
<input type="hidden" name="object" value="{{object.id}}">
<label for="name">Name:</label>
<input type="text" id="name" name="name" autocomplete="off"><br>
<input type="text" id="name" name="name" value="{{old.name}}" autocomplete="off"><br>
<label for="reciprocal_name">Reciprocal name:</label>
<input type="text" id="reciprocal_name" name="reciprocal_name" autocomplete="off"><br>
<input type="text" id="reciprocal_name" name="reciprocal_name" value="{{old.reciprocal_name}}" autocomplete="off"><br>
<label for="optional">Optional:</label>
<input type="checkbox" name="optional" id="optional" value="true" autocomplete="off">
<input type="checkbox" name="optional" id="optional" value="true" {{opt(checked=old.optional)}} autocomplete="off">
<br>
<label for="multiple">Multiple:</label>
<input type="checkbox" name="multiple" id="multiple" value="true" autocomplete="off"><br>
<input type="checkbox" name="multiple" id="multiple" value="true" {{opt(checked=old.multiple)}} autocomplete="off"><br>
<label for="related">Related object:</label>
<select name="related" id="related" autocomplete="off">
{% for m in models %}
<option value="{{ m.id }}">{{ m.name }}</option>
<option value="{{ m.id }}" {{selected(val=old.related, opt=m.id)}}>{{ m.name }}</option>
{% endfor %}
</select><br>