blob: ec8df1cc63c3b98e276b12e39594666bcb48f0a6 [file] [log] [blame]
items:
{%- for m in proto.messages | sort(attribute='name') %}
{%- if m.name != 'XOSBase' and xproto_unquote(xproto_first_non_empty([m.options.gui_hidden, 'False'])) != 'True' %}
- app: {{ xproto_unquote(xproto_first_non_empty([m.options.name, m.options.app_label, options.name, context.app_label])) }}
fields:
{%- set id_field = {'type':'int32', 'name':'id', 'options':{}} %}
{% for f in (xproto_base_fields(m, proto.message_table) + m.fields + [id_field]) | sort(attribute='name') -%}
{% if xproto_unquote(xproto_first_non_empty([f.options.gui_hidden, 'False'])) != 'True' and (not f.link or f.options.link_type != 'manytomany') -%}
- hint: {% if f.options.help_text %}{{ xproto_unquote(f.options.help_text) }}{% else %}''{% endif %}
{% if not f.link -%}
name: {{ f.name }}
{%- else -%}
name: {{ f.name }}_id
relation: {model: {{ f.options.model }}, type: {{ f.options.link_type }}}
{% endif %}
{%- if f.options.default %}
default: "{{ xproto_unquote(xproto_default_to_gui(f.options.default)) }}"
{%- endif %}
{%- if f.options.choices %}
options:
{% for o in xproto_options_choices_to_dict(xproto_unquote(f.options.choices)) %}
- {{ o }}
{% endfor %}
{%- endif %}
type: {{ xproto_type_to_ui_type(f) }}
{% set validators = xproto_validators(f) -%}
{% if validators -%}
validators:
{% for v in validators | sort(attribute='name',reverse=True) -%}
- {{ v | yaml }}
{% endfor %}
{% else -%}
validators: []
{% endif %}
{% endif -%}
{% endfor %}
name: {{ m.name }}
{%- set goodlinks = xproto_links_to_modeldef_relations( xproto_base_links(m, proto.message_table) + m.links ) + xproto_links_to_modeldef_relations( xproto_base_rlinks(m, proto.message_table) + m.rlinks )%}
{% if goodlinks %}
relations:
{{ goodlinks | join('\n') | indent(width=2)}}
{%- else %}
relations: []
{%- endif %}
{%- endif %}
{% endfor -%}