blob: 1640b4fb2d847e43cf3a569986c0ac0ba1724ce1 [file] [log] [blame]
Zack Williamsbe5ee1c2019-03-18 15:33:07 -07001---
2# Created by modeldefs.xtarget
Sapan Bhatiad022aeb2017-06-07 15:49:55 +02003items:
4{%- for m in proto.messages | sort(attribute='name') %}
Zack Williamsbe5ee1c2019-03-18 15:33:07 -07005{% if m.name != 'XOSBase' and xproto_unquote(xproto_first_non_empty([m.options.gui_hidden, 'False'])) != 'True' %}
6 - name: {{ m.name }}
7 app: {{ xproto_unquote(xproto_first_non_empty([m.options.name, m.options.app_label, options.name, context.app_label])) }}
8 {%- if m.options.verbose_name %}
9 verbose_name: "{{ xproto_unquote(m.options.verbose_name) }}"
10 {%- endif %}
11 {%- if m.options.description %}
12 description: "{{ xproto_unquote(m.options.description) }}"
13 {%- endif %}
vigneshethiraj880e3212019-06-04 23:03:20 +053014 {%- if m.options.sync_implemented %}
15 sync_implemented : "{{ xproto_unquote(m.options.sync_implemented) }}"
16 {%- endif %}
17 {%- if m.options.policy_implemented %}
18 policy_implemented : "{{ xproto_unquote(m.options.policy_implemented) }}"
19 {%- endif %}
Zack Williamsbe5ee1c2019-03-18 15:33:07 -070020 {%- 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 )%}
21 {%- if goodlinks %}
22 relations:
23 {%- for gl in goodlinks %}
24 - {{ gl }}
25 {%- endfor %}
26 {%- else %}
27 relations: []
28 {%- endif %}
29 fields:
30 {%- set id_field = {'type':'int32', 'name':'id', 'options':{}} %}
31 {%- for f in (xproto_base_fields(m, proto.message_table) + m.fields + [id_field]) | sort(attribute='name') %}
32 {%- if xproto_unquote(xproto_first_non_empty([f.options.gui_hidden, 'False'])) != 'True' and (not f.link or f.options.link_type != 'manytomany') %}
33 {%- if not f.link %}
34 - name: {{ f.name }}
35 {%- else %}
36 - name: {{ f.name }}_id
37 relation: {model: {{ f.options.model }}, type: {{ f.options.link_type }}}
38 {%- endif %}
39 hint: {% if f.options.help_text %}"{{ xproto_unquote(f.options.help_text) }}"{% else %}""{% endif %}
40 {%- if f.options.default %}
41 default: "{{ xproto_unquote(xproto_default_to_gui(f.options.default)) }}"
42 {%- endif %}
43 {%- if f.options.choices %}
44 options:
45 {%- for o in xproto_options_choices_to_dict(xproto_unquote(f.options.choices)) %}
46 - {{ xproto_dict_to_sorted_string(o) }}
47 {%- endfor %}
48 {%- endif %}
49 type: {{ xproto_type_to_ui_type(f) }}
50 read_only: {{ xproto_is_true(f.options.feedback_state) | lower }}
51 {%- set validators = xproto_validators(f) %}
52 {%- if validators %}
53 validators:
54 {%- for v in validators | sort(attribute='name', reverse=True) %}
55 - {{ v | yaml | indent(width=12)}}
56 {%- endfor %}
57 {%- else %}
58 validators: []
59 {%- endif %}
60 {%- endif %}
61 {%- endfor %}
Sapan Bhatiad022aeb2017-06-07 15:49:55 +020062{%- endif %}
Zack Williamsbe5ee1c2019-03-18 15:33:07 -070063{%- endfor %}