Custom model tologdict
diff --git a/xos/core/models/instance.py b/xos/core/models/instance.py
index 7f13eb8..6ba7cbf 100644
--- a/xos/core/models/instance.py
+++ b/xos/core/models/instance.py
@@ -104,6 +104,15 @@
def get_controller (self):
return self.node.site_deployment.controller
+ def tologdict(self):
+ d=super(Instance,self).tologdict()
+ try:
+ d['slice_name']=self.slice.name
+ d['controller_name']=self.get_controller().name
+ except:
+ pass
+ return d
+
def __unicode__(self):
if self.name and Slice.objects.filter(id=self.slice_id) and (self.name != self.slice.name):
# NOTE: The weird check on self.slice_id was due to a problem when
diff --git a/xos/core/models/network.py b/xos/core/models/network.py
index 80ee9ba..6af72bf 100644
--- a/xos/core/models/network.py
+++ b/xos/core/models/network.py
@@ -207,6 +207,15 @@
class Meta:
unique_together = ('network', 'controller')
+ def tologdict(self):
+ d=super(ControllerNetwork,self).tologdict()
+ try:
+ d['network_name']=self.network.name
+ d['controller_name']=self.controller.name
+ except:
+ pass
+ return d
+
@staticmethod
def select_by_user(user):
if user.is_admin:
diff --git a/xos/core/models/slice.py b/xos/core/models/slice.py
index 12c1ea2..a449691 100644
--- a/xos/core/models/slice.py
+++ b/xos/core/models/slice.py
@@ -184,6 +184,15 @@
class Meta:
unique_together = ('controller', 'slice')
+ def tologdict(self):
+ d=super(ControllerSlice,self).tologdict()
+ try:
+ d['slice_name']=self.slice.name
+ d['controller_name']=self.controller.name
+ except:
+ pass
+ return d
+
def __unicode__(self): return u'%s %s' % (self.slice, self.controller)
@staticmethod