set creator from caller in TenantWithContainer; delete duplicate creator.setter method
diff --git a/xos/core/models/service.py b/xos/core/models/service.py
index 135dce9..e33e7bc 100644
--- a/xos/core/models/service.py
+++ b/xos/core/models/service.py
@@ -599,14 +599,6 @@
raise XOSProgrammingError("No VPCE image (looked for %s)" % str(look_for_images))
- @creator.setter
- def creator(self, value):
- if value:
- value = value.id
- if (value != self.get_attribute("creator_id", None)):
- self.cached_creator=None
- self.set_attribute("creator_id", value)
-
def save_instance(self, instance):
# Override this function to do custom pre-save or post-save processing,
# such as creating ports for containers.
@@ -694,6 +686,11 @@
self.instance.delete()
self.instance = None
+ def save(self, *args, **kwargs):
+ if (not self.creator) and (hasattr(self, "caller")) and (self.caller):
+ self.creator = self.caller
+ super(TenantWithContainer, self).save(*args, **kwargs)
+
class CoarseTenant(Tenant):
""" TODO: rename "CoarseTenant" --> "StaticTenant" """
class Meta: