Sapan Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 1 | items: |
| 2 | {%- for m in proto.messages | sort(attribute='name') %} |
| 3 | {%- if m.name != 'XOSBase' %} |
Sapan Bhatia | aef145d | 2017-07-10 19:52:09 -0400 | [diff] [blame^] | 4 | - app: {{ xproto_unquote(xproto_first_non_empty([m.options.name, m.options.app_label, options.name, context.app_label])) }} |
Sapan Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 5 | fields: |
| 6 | {%- set id_field = {'type':'int32', 'name':'id', 'options':{}} %} |
| 7 | {% for f in (xproto_base_fields(m, proto.message_table) + m.fields + [id_field]) | sort(attribute='name') -%} |
| 8 | {% if not f.link or f.options.link_type != 'manytomany' -%} |
| 9 | - hint: {% if f.options.help_text %}{{ xproto_unquote(f.options.help_text) }}{% else %}''{% endif %} |
| 10 | {% if not f.link -%} |
| 11 | name: {{ f.name }} |
| 12 | {%- else -%} |
| 13 | name: {{ f.name }}_id |
| 14 | relation: {model: {{ f.options.model }}, type: {{ f.options.link_type }}} |
| 15 | {% endif %} |
| 16 | type: {{ xproto_type_to_ui_type(f) }} |
| 17 | {% set validators = xproto_validators(f) -%} |
| 18 | {% if validators -%} |
| 19 | validators: |
| 20 | {% for v in validators | sort(attribute='name',reverse=True) -%} |
| 21 | - {{ v | yaml }} |
| 22 | {% endfor %} |
| 23 | {% else -%} |
| 24 | validators: [] |
| 25 | {% endif %} |
| 26 | {% endif -%} |
| 27 | {% endfor %} |
| 28 | name: {{ m.name }} |
| 29 | {%- set goodlinks = xproto_links_to_modeldef_relations( xproto_base_links(m, proto.message_table) + m.links ) %} |
| 30 | {% if goodlinks %} |
| 31 | relations: |
| 32 | {{ goodlinks | join('\n') | indent(width=2)}} |
| 33 | {%- else %} |
| 34 | relations: [] |
| 35 | {%- endif %} |
| 36 | {%- endif %} |
| 37 | {% endfor -%} |