CORD-2990 add uniqueness constraints for names in the core;
pass unique keyword through to django;
support unique_with in services
Change-Id: I33e9f6b2504b5029fa75dad8251a56e2c8e364c2
diff --git a/lib/xos-genx/xosgenx/targets/service.xtarget b/lib/xos-genx/xosgenx/targets/service.xtarget
index ed78ff1..7b40110 100644
--- a/lib/xos-genx/xosgenx/targets/service.xtarget
+++ b/lib/xos-genx/xosgenx/targets/service.xtarget
@@ -56,6 +56,10 @@
app_label = {{ xproto_first_non_empty([m.options.app_label, options.app_label, options.name, "Set an app label in your xproto!"]) | lower}}
# name = {{ xproto_first_non_empty([m.options.name, options.name, "Set a name in your xproto!"]) }}
verbose_name = "{{ xproto_unquote(xproto_first_non_empty([m.options.verbose_name, m.name])) }}"
+ {%- set uniques = xproto_field_graph_components(m.fields) %}
+ {%- if uniques %}
+ unique_together = {{ xproto_tuplify(uniques) }}
+ {%- endif %}
# Primitive Fields (Not Relations)
{% for f in m.fields %}