CORD-1594: Tag models with information about the leaf model, for casting
generic instances into specialized ones
Change-Id: I7b0f283b11380363742a284dc794bf3914e81fc9
diff --git a/lib/xos-genx/xosgenx/targets/django.xtarget b/lib/xos-genx/xosgenx/targets/django.xtarget
index 400596c..e9a56ec 100644
--- a/lib/xos-genx/xosgenx/targets/django.xtarget
+++ b/lib/xos-genx/xosgenx/targets/django.xtarget
@@ -45,6 +45,9 @@
{% if m.name!='XOSBase' and 'Mixin' not in m.name %}
# Generated methods
def save(self, *args, **kwds):
+ if not self.leaf_model_name:
+ self.leaf_model_name = "{{ m.name }}"
+
try:
self.__xos_save_base(*args, **kwds)
except AttributeError: