wip reciprocal relation names
This commit is contained in:
@@ -45,7 +45,7 @@
|
||||
<ul>
|
||||
{% for rel in model.relations %}
|
||||
<li>
|
||||
<span title="{{rel.model.id}}">"{{rel.model.name}}", pointing to: <i>{{rel.related_name}}</i></span>
|
||||
<span title="{{rel.model.id}}">"{{rel.model.name}}", pointing to: <i>{{rel.related_name}}</i> (reciprocal as "{{rel.model.reciprocal_name}}")</span>
|
||||
{%- if rel.model.optional %}, OPTIONAL{% endif %}
|
||||
{%- if rel.model.multiple %}, MULTIPLE{% endif %}
|
||||
<br>
|
||||
|
||||
@@ -20,6 +20,9 @@ Define relation
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" id="name" name="name"><br>
|
||||
|
||||
<label for="reciprocal_name">Reciprocal name:</label>
|
||||
<input type="text" id="reciprocal_name" name="reciprocal_name"><br>
|
||||
|
||||
<label for="optional">Optional:</label>
|
||||
<input type="checkbox" name="optional" id="optional" value="1">
|
||||
<br>
|
||||
|
||||
@@ -168,6 +168,7 @@ fn init_yopa() -> YopaStoreWrapper {
|
||||
id: Default::default(),
|
||||
object: id_recipe,
|
||||
name: "book reference".to_string(),
|
||||
reciprocal_name: "recipes".to_string(),
|
||||
optional: true,
|
||||
multiple: true,
|
||||
related: id_book
|
||||
@@ -187,6 +188,7 @@ fn init_yopa() -> YopaStoreWrapper {
|
||||
id: Default::default(),
|
||||
object: id_recipe,
|
||||
name: "related recipe".to_string(),
|
||||
reciprocal_name: "related recipe".to_string(),
|
||||
optional: true,
|
||||
multiple: true,
|
||||
related: id_recipe
|
||||
|
||||
@@ -178,6 +178,7 @@ pub(crate) async fn relation_model_create_form(
|
||||
pub(crate) struct RelationModelCreate {
|
||||
pub object : ID,
|
||||
pub name : String,
|
||||
pub reciprocal_name : String,
|
||||
pub optional : Option<i32>,
|
||||
pub multiple : Option<i32>,
|
||||
pub related : ID,
|
||||
@@ -195,6 +196,7 @@ pub(crate) async fn relation_model_create(
|
||||
id: Default::default(),
|
||||
object: form.object,
|
||||
name: form.name.clone(),
|
||||
reciprocal_name: form.reciprocal_name.clone(),
|
||||
optional: form.optional.unwrap_or_default() != 0,
|
||||
multiple: form.multiple.unwrap_or_default() != 0,
|
||||
related: form.related
|
||||
|
||||
Reference in New Issue
Block a user