[CORD-2232] Removing feedback state from model that does not have synchronizers
Change-Id: If6b1513ee7baf48fc0273719d6c69449dd55fa2e
diff --git a/lib/xos-genx/xosgenx/jinja2_extensions/base.py b/lib/xos-genx/xosgenx/jinja2_extensions/base.py
index 93f4581..d3982f1 100644
--- a/lib/xos-genx/xosgenx/jinja2_extensions/base.py
+++ b/lib/xos-genx/xosgenx/jinja2_extensions/base.py
@@ -124,6 +124,12 @@
fields.extend(base_fields)
fields.extend(model_fields)
+ if 'no_sync' in m['options'] and m['options']['no_sync']:
+ fields = [f for f in fields if f['name'] != 'backend_status' and f['name'] != 'backend_code']
+
+ if 'no_policy' in m['options'] and m['options']['no_policy']:
+ fields = [f for f in fields if f['name'] != 'policy_status' and f['name'] != 'policy_code']
+
return fields
def xproto_base_rlinks(m, table):
diff --git a/lib/xos-genx/xosgenx/targets/django.xtarget b/lib/xos-genx/xosgenx/targets/django.xtarget
index 1c8ce93..ca81240 100644
--- a/lib/xos-genx/xosgenx/targets/django.xtarget
+++ b/lib/xos-genx/xosgenx/targets/django.xtarget
@@ -27,6 +27,19 @@
class {{ m.name }}{{ xproto_base_def(m.name, m.bases) }}:
plural_name = "{{ xproto_pluralize(m) }}"
+{# {% if m.options.no_sync or m.options.no_policy %}#}
+{# {% if m.options.no_sync -%}#}
+{# # Removing synchronizer feedback state from model#}
+{# backend_status = None#}
+{# backend_code = None#}
+{# {%- endif %}#}
+{# {% if m.options.no_policy -%}#}
+{# # Removing model policy feedback state from model#}
+{# policy_code = None#}
+{# policy_status = None#}
+{# {%- endif %}#}
+{# {% endif %}#}
+
# Primitive Fields (Not Relations)
{% for f in m.fields %}
{%- if not f.link -%}
diff --git a/xos/core/models/core.xproto b/xos/core/models/core.xproto
index bd4be4b..482a572 100644
--- a/xos/core/models/core.xproto
+++ b/xos/core/models/core.xproto
@@ -588,6 +588,9 @@
message XOSGuiExtension (XOSBase) {
option verbose_name="XOS GUI Extension";
option description="This model holds the instruction to load an extension in the GUI";
+ option no_sync = True;
+ option no_policy = True;
+
required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name of the GUI Extensions", null = False, db_index = False];
required string files = 2 [max_length = 1024, content_type = "stripped", blank = False, help_text = "List of comma separated file composing the view", null = False, db_index = False];
}