You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
2.2 KiB
96 lines
2.2 KiB
{% extends "_layout" %}
|
|
{% import "models/_schema_macros" as macros %}
|
|
|
|
{% block title -%}
|
|
Index
|
|
{%- endblock %}
|
|
|
|
{% block nav -%}
|
|
<a href="/">Home</a>
|
|
{%- endblock %}
|
|
|
|
{% block content -%}
|
|
|
|
<h1>Models</h1>
|
|
|
|
<a href="/model/object/create">New model</a>
|
|
|
|
<h2>Defined models:</h2>
|
|
|
|
{% if models %}
|
|
<ul>
|
|
{% for model in models %}
|
|
<li>
|
|
<b title="{{model.id}}">{{model.name}}</b><br>
|
|
|
|
<!--
|
|
|
|
{{ model | json_encode(pretty=true) | safe }}
|
|
|
|
-->
|
|
|
|
<a href="/model/object/delete/{{model.id}}" onclick="return confirm('Delete model?')">Delete model</a> ·
|
|
<a href="/model/object/update/{{model.id}}">Edit model</a> ·
|
|
<a href="/model/relation/create/{{model.id}}">New relation</a> ·
|
|
<a href="/model/property/create/{{model.id}}">New property</a>
|
|
<br>
|
|
|
|
{% if model.properties %}
|
|
Properties:
|
|
<ul>
|
|
{% for prop in model.properties %}
|
|
<li>
|
|
{{ macros::describe_property(prop=prop) }}
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
|
|
{% if model.relations %}
|
|
Relations:
|
|
<ul>
|
|
{% for rel in model.relations %}
|
|
<li>
|
|
<span title="{{rel.model.id}}">"{{rel.model.name}}" -> <i>{{rel.related_name}} (reciprocally as "{{rel.model.reciprocal_name}}")</i></span>
|
|
{%- if rel.model.optional %}, OPTIONAL{% endif %}
|
|
{%- if rel.model.multiple %}, MULTIPLE{% endif %}
|
|
<br>
|
|
|
|
<a href="/model/relation/update/{{rel.model.id}}">Edit relation</a> ·
|
|
<a href="/model/relation/delete/{{rel.model.id}}" onclick="return confirm('Delete relation?')">Delete relation</a> ·
|
|
<a href="/model/property/create/{{rel.model.id}}">New property</a>
|
|
<br>
|
|
|
|
{% if rel.properties %}
|
|
Properties:
|
|
<ul>
|
|
{% for prop in rel.properties %}
|
|
<li title="{{prop.id}}">
|
|
{{ macros::describe_property(prop=prop) }}
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
|
|
{% if model.reciprocal_relations %}
|
|
Incoming relations:
|
|
<ul>
|
|
{% for rel in model.reciprocal_relations %}
|
|
<li>
|
|
<span title="{{rel.model.id}}">"{{rel.model.reciprocal_name}}" <- <i>{{rel.related_name}}</i> (reciprocally as "{{rel.model.name}}")</span>
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% else %}
|
|
<p>No models defined.</p>
|
|
{% endif %}
|
|
|
|
{%- endblock %}
|
|
|