blob: 94b4136950241175e35df8f73e9e87609069feba [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 %}
14 {%- 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 )%}
15 {%- if goodlinks %}
16 relations:
17 {%- for gl in goodlinks %}
18 - {{ gl }}
19 {%- endfor %}
20 {%- else %}
21 relations: []
22 {%- endif %}
23 fields:
24 {%- set id_field = {'type':'int32', 'name':'id', 'options':{}} %}
25 {%- for f in (xproto_base_fields(m, proto.message_table) + m.fields + [id_field]) | sort(attribute='name') %}
26 {%- if xproto_unquote(xproto_first_non_empty([f.options.gui_hidden, 'False'])) != 'True' and (not f.link or f.options.link_type != 'manytomany') %}
27 {%- if not f.link %}
28 - name: {{ f.name }}
29 {%- else %}
30 - name: {{ f.name }}_id
31 relation: {model: {{ f.options.model }}, type: {{ f.options.link_type }}}
32 {%- endif %}
33 hint: {% if f.options.help_text %}"{{ xproto_unquote(f.options.help_text) }}"{% else %}""{% endif %}
34 {%- if f.options.default %}
35 default: "{{ xproto_unquote(xproto_default_to_gui(f.options.default)) }}"
36 {%- endif %}
37 {%- if f.options.choices %}
38 options:
39 {%- for o in xproto_options_choices_to_dict(xproto_unquote(f.options.choices)) %}
40 - {{ xproto_dict_to_sorted_string(o) }}
41 {%- endfor %}
42 {%- endif %}
43 type: {{ xproto_type_to_ui_type(f) }}
44 read_only: {{ xproto_is_true(f.options.feedback_state) | lower }}
45 {%- set validators = xproto_validators(f) %}
46 {%- if validators %}
47 validators:
48 {%- for v in validators | sort(attribute='name', reverse=True) %}
49 - {{ v | yaml | indent(width=12)}}
50 {%- endfor %}
51 {%- else %}
52 validators: []
53 {%- endif %}
54 {%- endif %}
55 {%- endfor %}
Sapan Bhatiad022aeb2017-06-07 15:49:55 +020056{%- endif %}
Zack Williamsbe5ee1c2019-03-18 15:33:07 -070057{%- endfor %}