CORD-1244 remove unicode functions

Change-Id: Ic86df85cd0dd789e211fd6489b720e8856c7cf67
diff --git a/xos/core/models/attic/addresspool_model.py b/xos/core/models/attic/addresspool_model.py
index 47576f1..e612b11 100644
--- a/xos/core/models/attic/addresspool_model.py
+++ b/xos/core/models/attic/addresspool_model.py
@@ -1,5 +1,3 @@
-def __unicode__(self): return u'%s' % (self.name)
-
 def get_address(self):
     with transaction.atomic():
         ap = AddressPool.objects.get(pk=self.pk)
diff --git a/xos/core/models/attic/controller_model.py b/xos/core/models/attic/controller_model.py
index b053cab..e20370c 100644
--- a/xos/core/models/attic/controller_model.py
+++ b/xos/core/models/attic/controller_model.py
@@ -5,8 +5,6 @@
     super(Controller, self).__init__(*args, **kwargs)
     self.no_sync=True
 
-def __unicode__(self):  return u'%s %s %s' % (self.name, self.backend_type, self.version)
-
 @property
 def auth_url_v3(self):
     if self.auth_url and self.auth_url[-1] == '/':
diff --git a/xos/core/models/attic/controllercredential_model.py b/xos/core/models/attic/controllercredential_model.py
index 64ee81b..e8a03a8 100644
--- a/xos/core/models/attic/controllercredential_model.py
+++ b/xos/core/models/attic/controllercredential_model.py
@@ -1,5 +1,3 @@
 objects = ControllerLinkManager()
 deleted_objects = ControllerLinkDeletionManager()
 
-def __unicode__(self):
-    return self.name
diff --git a/xos/core/models/attic/controllerimages_model.py b/xos/core/models/attic/controllerimages_model.py
index 42f2d1a..1a6652c 100644
--- a/xos/core/models/attic/controllerimages_model.py
+++ b/xos/core/models/attic/controllerimages_model.py
@@ -1,7 +1,5 @@
 class Meta:
     unique_together = ('image', 'controller')
          
-def __unicode__(self):  return u'%s %s' % (self.image, self.controller)
-
 objects = ControllerLinkManager()
 deleted_objects = ControllerLinkDeletionManager()
diff --git a/xos/core/models/attic/controllerrole_model.py b/xos/core/models/attic/controllerrole_model.py
deleted file mode 100644
index c5ebd53..0000000
--- a/xos/core/models/attic/controllerrole_model.py
+++ /dev/null
@@ -1 +0,0 @@
-def __unicode__(self):  return u'%s' % (self.role)
diff --git a/xos/core/models/attic/controllersiteprivilege_model.py b/xos/core/models/attic/controllersiteprivilege_model.py
index a3b3451..c082663 100644
--- a/xos/core/models/attic/controllersiteprivilege_model.py
+++ b/xos/core/models/attic/controllersiteprivilege_model.py
@@ -4,8 +4,6 @@
 class Meta:
     unique_together = ('controller', 'site_privilege', 'role_id')
 
-def __unicode__(self):  return u'%s %s' % (self.controller, self.site_privilege)
-
 def can_update(self, user):
     if user.is_readonly:
         return False
diff --git a/xos/core/models/attic/controllerslice_model.py b/xos/core/models/attic/controllerslice_model.py
index 9e9fdc3..b55ed16 100644
--- a/xos/core/models/attic/controllerslice_model.py
+++ b/xos/core/models/attic/controllerslice_model.py
@@ -13,8 +13,6 @@
         pass
     return d
 
-def __unicode__(self):  return u'%s %s'  % (self.slice, self.controller)
-
 @staticmethod
 def select_by_user(user):
     if user.is_admin:
diff --git a/xos/core/models/attic/controllersliceprivilege_model.py b/xos/core/models/attic/controllersliceprivilege_model.py
index 6414464..12c01a3 100644
--- a/xos/core/models/attic/controllersliceprivilege_model.py
+++ b/xos/core/models/attic/controllersliceprivilege_model.py
@@ -1,8 +1,6 @@
 class Meta:
     unique_together = ('controller', 'slice_privilege')
 
-def __unicode__(self):  return u'%s %s' % (self.controller, self.slice_privilege)
-
 def can_update(self, user):
     if user.is_readonly:
         return False
diff --git a/xos/core/models/attic/controlleruser_model.py b/xos/core/models/attic/controlleruser_model.py
index d6d73cb..0b485c5 100644
--- a/xos/core/models/attic/controlleruser_model.py
+++ b/xos/core/models/attic/controlleruser_model.py
@@ -4,8 +4,6 @@
 class Meta:
     unique_together = ('user', 'controller')
 
-def __unicode__(self):  return u'%s %s' % (self.controller, self.user)
-
 @staticmethod
 def select_by_user(user):
     if user.is_admin:
diff --git a/xos/core/models/attic/dashboardview_model.py b/xos/core/models/attic/dashboardview_model.py
deleted file mode 100644
index 087b164..0000000
--- a/xos/core/models/attic/dashboardview_model.py
+++ /dev/null
@@ -1 +0,0 @@
-def __unicode__(self): return u'%s' % (self.name)
diff --git a/xos/core/models/attic/deployment_model.py b/xos/core/models/attic/deployment_model.py
index a055df3..78f6e4e 100644
--- a/xos/core/models/attic/deployment_model.py
+++ b/xos/core/models/attic/deployment_model.py
@@ -37,4 +37,3 @@
 def can_update(self, user):
     return user.can_update_deployment(self)
 
-def __unicode__(self):  return u'%s' % (self.name)
diff --git a/xos/core/models/attic/deploymentprivilege_model.py b/xos/core/models/attic/deploymentprivilege_model.py
index 539234c..24281b3 100644
--- a/xos/core/models/attic/deploymentprivilege_model.py
+++ b/xos/core/models/attic/deploymentprivilege_model.py
@@ -1,8 +1,6 @@
 class Meta:
     unique_together = ('user', 'deployment', 'role')
 
-def __unicode__(self):  return u'%s %s %s' % (self.deployment, self.user, self.role)
-
 def can_update(self, user):
     return user.can_update_deployment(self)
 
diff --git a/xos/core/models/attic/deploymentrole_model.py b/xos/core/models/attic/deploymentrole_model.py
deleted file mode 100644
index b35a54b..0000000
--- a/xos/core/models/attic/deploymentrole_model.py
+++ /dev/null
@@ -1 +0,0 @@
-def __unicode__(self): return u'%s' % (self.role)
diff --git a/xos/core/models/attic/flavor_model.py b/xos/core/models/attic/flavor_model.py
index f5403f7..56e0e52 100644
--- a/xos/core/models/attic/flavor_model.py
+++ b/xos/core/models/attic/flavor_model.py
@@ -6,4 +6,3 @@
     super(Flavor, self).__init__(*args, **kwargs)
     self.no_sync=True
 
-def __unicode__(self):  return u'%s' % (self.name)
diff --git a/xos/core/models/attic/image_model.py b/xos/core/models/attic/image_model.py
index 32aa211..e8a03a8 100644
--- a/xos/core/models/attic/image_model.py
+++ b/xos/core/models/attic/image_model.py
@@ -1,4 +1,3 @@
 objects = ControllerLinkManager()
 deleted_objects = ControllerLinkDeletionManager()
 
-def __unicode__(self):  return u'%s' % (self.name)
diff --git a/xos/core/models/attic/imagedeployments_model.py b/xos/core/models/attic/imagedeployments_model.py
index 612cbb2..4c3ad952 100644
--- a/xos/core/models/attic/imagedeployments_model.py
+++ b/xos/core/models/attic/imagedeployments_model.py
@@ -1,7 +1,5 @@
 class Meta:
     unique_together = ('image', 'deployment')
 
-def __unicode__(self):  return u'%s %s' % (self.image, self.deployment)
-
 def can_update(self, user):
     return user.can_update_deployment(self.deployment)
diff --git a/xos/core/models/attic/instance_model.py b/xos/core/models/attic/instance_model.py
index b42dcfc..95cd54e 100644
--- a/xos/core/models/attic/instance_model.py
+++ b/xos/core/models/attic/instance_model.py
@@ -13,20 +13,6 @@
         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
-        #   deleting the slice before the instance.
-        return u'%s' % self.name
-    elif self.instance_name:
-        return u'%s' % (self.instance_name)
-    elif self.id:
-        return u'uninstantiated-%s' % str(self.id)
-    elif self.slice:
-        return u'unsaved-instance on %s' % self.slice.name
-    else:
-        return u'unsaved-instance'
-
 def save(self, *args, **kwds):
     if not self.name:
         self.name = self.slice.name
diff --git a/xos/core/models/attic/network_model.py b/xos/core/models/attic/network_model.py
index 673ea4b..20180a2 100644
--- a/xos/core/models/attic/network_model.py
+++ b/xos/core/models/attic/network_model.py
@@ -1,5 +1,3 @@
-def __unicode__(self):  return u'%s' % (self.name)
-
 def save(self, *args, **kwds):
     super(Network, self).save(*args, **kwds)
 
diff --git a/xos/core/models/attic/networkparameter_model.py b/xos/core/models/attic/networkparameter_model.py
deleted file mode 100644
index d2e301ba..0000000
--- a/xos/core/models/attic/networkparameter_model.py
+++ /dev/null
@@ -1,3 +0,0 @@
-def __unicode__(self):
-    return self.parameter.name
-
diff --git a/xos/core/models/attic/networkparametertype_model.py b/xos/core/models/attic/networkparametertype_model.py
deleted file mode 100644
index 3fd623e..0000000
--- a/xos/core/models/attic/networkparametertype_model.py
+++ /dev/null
@@ -1 +0,0 @@
-def __unicode__(self):  return u'%s' % (self.name)
diff --git a/xos/core/models/attic/networkslice_model.py b/xos/core/models/attic/networkslice_model.py
index 9c038fa..1160806 100644
--- a/xos/core/models/attic/networkslice_model.py
+++ b/xos/core/models/attic/networkslice_model.py
@@ -12,8 +12,6 @@
 
     super(NetworkSlice, self).save(*args, **kwds)
 
-def __unicode__(self):  return u'%s-%s' % (self.network.name, self.slice.name)
-
 def can_update(self, user):
     return user.can_update_slice(self.slice)
 
diff --git a/xos/core/models/attic/networktemplate_model.py b/xos/core/models/attic/networktemplate_model.py
deleted file mode 100644
index 2bd4db3..0000000
--- a/xos/core/models/attic/networktemplate_model.py
+++ /dev/null
@@ -1,21 +0,0 @@
-ACCESS_CHOICES = ((None, 'None'), ('indirect', 'Indirect'), ('direct', 'Direct'))
-
-def __init__(self, *args, **kwargs):
-    super(NetworkTemplate, self).__init__(*args, **kwargs)
-
-    if (self.topology_kind=="BigSwitch"):
-        print >> sys.stderr, "XXX warning: topology_kind invalid case"
-        self.topology_kind="bigswitch"
-    elif (self.topology_kind=="Physical"):
-        print >> sys.stderr, "XXX warning: topology_kind invalid case"
-        self.topology_kind="physical"
-    elif (self.topology_kind=="Custom"):
-        print >> sys.stderr, "XXX warning: topology_kind invalid case"
-        self.toplogy_kind="custom"
-
-def save(self, *args, **kwargs):
-    self.enforce_choices(self.access, self.ACCESS_CHOICES)
-    super(NetworkTemplate, self).save(*args, **kwargs)
-
-def __unicode__(self):  return u'%s' % (self.name)
-
diff --git a/xos/core/models/attic/node_model.py b/xos/core/models/attic/node_model.py
index 71b769c..98c5ed4 100644
--- a/xos/core/models/attic/node_model.py
+++ b/xos/core/models/attic/node_model.py
@@ -1,5 +1,3 @@
-def __unicode__(self):  return u'%s' % (self.name)
-
 def __init__(self, *args, **kwargs):
     super(Node, self).__init__(*args, **kwargs)
     self.no_sync=True
diff --git a/xos/core/models/attic/nodelabel_model.py b/xos/core/models/attic/nodelabel_model.py
deleted file mode 100644
index 087b164..0000000
--- a/xos/core/models/attic/nodelabel_model.py
+++ /dev/null
@@ -1 +0,0 @@
-def __unicode__(self): return u'%s' % (self.name)
diff --git a/xos/core/models/attic/port_model.py b/xos/core/models/attic/port_model.py
index 3b3ffcc..507e923 100644
--- a/xos/core/models/attic/port_model.py
+++ b/xos/core/models/attic/port_model.py
@@ -13,12 +13,6 @@
 
     super(Port, self).save(*args, **kwds)
 
-def __unicode__(self):
-    if self.instance:
-        return u'%s-%s' % (self.network.name, self.instance.instance_name)
-    else:
-        return u'%s-unboundport-%s' % (self.network.name, self.id)
-
 def can_update(self, user):
     if self.instance:
         return user.can_update_slice(self.instance.slice)
diff --git a/xos/core/models/attic/role_model.py b/xos/core/models/attic/role_model.py
deleted file mode 100644
index 81bd86e..0000000
--- a/xos/core/models/attic/role_model.py
+++ /dev/null
@@ -1 +0,0 @@
-def __unicode__(self):  return u'%s:%s' % (self.content_type,self.role_type)
diff --git a/xos/core/models/attic/service_model.py b/xos/core/models/attic/service_model.py
index 1798018..5959f86 100644
--- a/xos/core/models/attic/service_model.py
+++ b/xos/core/models/attic/service_model.py
@@ -34,8 +34,6 @@
         attrs[attr.name] = attr.value
     return attrs
 
-def __unicode__(self): return u'%s' % (self.name)
-
 def can_update(self, user):
     return user.can_update_service(self, allow=['admin'])
 
diff --git a/xos/core/models/attic/serviceprivilege_model.py b/xos/core/models/attic/serviceprivilege_model.py
index 64ca985..a5bb038 100644
--- a/xos/core/models/attic/serviceprivilege_model.py
+++ b/xos/core/models/attic/serviceprivilege_model.py
@@ -1,9 +1,6 @@
 class Meta:
     unique_together = ('user', 'service', 'role')
 
-def __unicode__(self): return u'%s %s %s' % (
-    self.service, self.user, self.role)
-
 def can_update(self, user):
     if not self.service.enabled:
         raise PermissionDenied, "Cannot modify permission(s) of a disabled service"
diff --git a/xos/core/models/attic/servicerole_model.py b/xos/core/models/attic/servicerole_model.py
deleted file mode 100644
index b35a54b..0000000
--- a/xos/core/models/attic/servicerole_model.py
+++ /dev/null
@@ -1 +0,0 @@
-def __unicode__(self): return u'%s' % (self.role)
diff --git a/xos/core/models/attic/site_model.py b/xos/core/models/attic/site_model.py
index a256049..df5ea4e 100644
--- a/xos/core/models/attic/site_model.py
+++ b/xos/core/models/attic/site_model.py
@@ -1,8 +1,6 @@
 objects = ControllerManager()
 deleted_objects = ControllerDeletionManager()
 
-def __unicode__(self):  return u'%s' % (self.name)
-
 def can_update(self, user):
     return user.can_update_site(self, allow=['pi'])
 
diff --git a/xos/core/models/attic/sitedeployment_model.py b/xos/core/models/attic/sitedeployment_model.py
index a4383f3..f9c33d1 100644
--- a/xos/core/models/attic/sitedeployment_model.py
+++ b/xos/core/models/attic/sitedeployment_model.py
@@ -4,4 +4,3 @@
 class Meta:
     unique_together = ('site', 'deployment', 'controller')
 
-def __unicode__(self):  return u'%s %s' % (self.deployment, self.site)
diff --git a/xos/core/models/attic/siteprivilege_model.py b/xos/core/models/attic/siteprivilege_model.py
index fde823f..6130d6a 100644
--- a/xos/core/models/attic/siteprivilege_model.py
+++ b/xos/core/models/attic/siteprivilege_model.py
@@ -1,5 +1,3 @@
-def __unicode__(self):  return u'%s %s %s' % (self.site, self.user, self.role)
-
 def can_update(self, user):
     return user.can_update_site(self, allow=['pi'])
 
diff --git a/xos/core/models/attic/siterole_model.py b/xos/core/models/attic/siterole_model.py
deleted file mode 100644
index c5ebd53..0000000
--- a/xos/core/models/attic/siterole_model.py
+++ /dev/null
@@ -1 +0,0 @@
-def __unicode__(self):  return u'%s' % (self.role)
diff --git a/xos/core/models/attic/slice_model.py b/xos/core/models/attic/slice_model.py
index b9aba1b..503a3f9 100644
--- a/xos/core/models/attic/slice_model.py
+++ b/xos/core/models/attic/slice_model.py
@@ -1,7 +1,5 @@
 NETWORK_CHOICES = ((None, 'Default'), ('host', 'Host'), ('bridged', 'Bridged'), ('noauto', 'No Automatic Networks'))
 
-def __unicode__(self):  return u'%s' % (self.name)
-
 @property
 def slicename(self):
     return "%s_%s" % (self.site.login_base, self.name)
diff --git a/xos/core/models/attic/sliceprivilege_model.py b/xos/core/models/attic/sliceprivilege_model.py
index c7e0bfb..3dd30e4 100644
--- a/xos/core/models/attic/sliceprivilege_model.py
+++ b/xos/core/models/attic/sliceprivilege_model.py
@@ -1,8 +1,6 @@
 class Meta:
     unique_together = ('user', 'slice', 'role')
 
-def __unicode__(self):  return u'%s %s %s' % (self.slice, self.user, self.role)
-
 def save(self, *args, **kwds):
     super(SlicePrivilege, self).save(*args, **kwds)
 
diff --git a/xos/core/models/attic/slicerole_model.py b/xos/core/models/attic/slicerole_model.py
deleted file mode 100644
index c5ebd53..0000000
--- a/xos/core/models/attic/slicerole_model.py
+++ /dev/null
@@ -1 +0,0 @@
-def __unicode__(self):  return u'%s' % (self.role)
diff --git a/xos/core/models/attic/tag_model.py b/xos/core/models/attic/tag_model.py
index 7872679..f67ee60 100644
--- a/xos/core/models/attic/tag_model.py
+++ b/xos/core/models/attic/tag_model.py
@@ -1,6 +1,3 @@
-def __unicode__(self):
-    return self.name
-
 def can_update(self, user):
     return user.can_update_root()
 
diff --git a/xos/core/models/attic/tenant_model.py b/xos/core/models/attic/tenant_model.py
index 6a2e074..168c7ad 100644
--- a/xos/core/models/attic/tenant_model.py
+++ b/xos/core/models/attic/tenant_model.py
@@ -5,9 +5,6 @@
     self._meta.get_field("kind").default = self.KIND
     super(Tenant, self).__init__(*args, **kwargs)
 
-def __unicode__(self):
-    return u"%s-tenant-%s" % (str(self.kind), str(self.id))
-
 @classmethod
 def get_tenant_objects(cls):
     return cls.objects.filter(kind=cls.KIND)
diff --git a/xos/core/models/attic/tenantattribute_model.py b/xos/core/models/attic/tenantattribute_model.py
deleted file mode 100644
index ec771ed..0000000
--- a/xos/core/models/attic/tenantattribute_model.py
+++ /dev/null
@@ -1 +0,0 @@
-def __unicode__(self): return u'%s-%s' % (self.name, self.id)
diff --git a/xos/core/models/attic/tenantprivilege_model.py b/xos/core/models/attic/tenantprivilege_model.py
index 165eb89..1c416f2 100644
--- a/xos/core/models/attic/tenantprivilege_model.py
+++ b/xos/core/models/attic/tenantprivilege_model.py
@@ -1,6 +1,3 @@
-def __unicode__(self): return u'%s %s %s' % (
-    self.tenant, self.user, self.role)
-
 def save(self, *args, **kwds):
     if not self.user.is_active:
         raise PermissionDenied, "Cannot modify role(s) of a disabled user"
diff --git a/xos/core/models/attic/tenantrole_model.py b/xos/core/models/attic/tenantrole_model.py
deleted file mode 100644
index b35a54b..0000000
--- a/xos/core/models/attic/tenantrole_model.py
+++ /dev/null
@@ -1 +0,0 @@
-def __unicode__(self): return u'%s' % (self.role)
diff --git a/xos/core/models/attic/tenantroot_model.py b/xos/core/models/attic/tenantroot_model.py
index b9501af..20e3480 100644
--- a/xos/core/models/attic/tenantroot_model.py
+++ b/xos/core/models/attic/tenantroot_model.py
@@ -5,12 +5,6 @@
     self._meta.get_field("kind").default = self.KIND
     super(TenantRoot, self).__init__(*args, **kwargs)
 
-def __unicode__(self):
-    if not self.name:
-        return u"%s-tenant_root-#%s" % (str(self.kind), str(self.id))
-    else:
-        return self.name
-
 def can_update(self, user):
     return user.can_update_tenant_root(self, allow=['admin'])
 
diff --git a/xos/core/models/attic/tenantrootprivilege_model.py b/xos/core/models/attic/tenantrootprivilege_model.py
index 158f1c0..c2d054e 100644
--- a/xos/core/models/attic/tenantrootprivilege_model.py
+++ b/xos/core/models/attic/tenantrootprivilege_model.py
@@ -1,9 +1,6 @@
 class Meta:
     unique_together = ('user', 'tenant_root', 'role')
 
-def __unicode__(self): return u'%s %s %s' % (
-    self.tenant_root, self.user, self.role)
-
 def save(self, *args, **kwds):
     if not self.user.is_active:
         raise PermissionDenied, "Cannot modify role(s) of a disabled user"
diff --git a/xos/core/models/attic/tenantrootrole_model.py b/xos/core/models/attic/tenantrootrole_model.py
deleted file mode 100644
index b35a54b..0000000
--- a/xos/core/models/attic/tenantrootrole_model.py
+++ /dev/null
@@ -1 +0,0 @@
-def __unicode__(self): return u'%s' % (self.role)
diff --git a/xos/core/models/attic/xos_model.py b/xos/core/models/attic/xos_model.py
deleted file mode 100644
index d81429c..0000000
--- a/xos/core/models/attic/xos_model.py
+++ /dev/null
@@ -1,14 +0,0 @@
-def __unicode__(self):  return u'%s' % (self.name)
-
-def __init__(self, *args, **kwargs):
-    super(XOS, self).__init__(*args, **kwargs)
-
-def save(self, *args, **kwds):
-    super(XOS, self).save(*args, **kwds)
-
-#    def can_update(self, user):
-#        return user.can_update_site(self.site, allow=['tech'])
-
-def rebuild(self, services=[]):
-    raise Exception("Not Implemented")
-
diff --git a/xos/core/models/plcorebase.py b/xos/core/models/plcorebase.py
index a99fd15..aa80718 100644
--- a/xos/core/models/plcorebase.py
+++ b/xos/core/models/plcorebase.py
@@ -431,6 +431,15 @@
 
         return d
 
+    # for the old django admin UI
+    def __unicode__(self):
+        if hasattr(self, "name") and self.name:
+            return u'%s' % self.name
+        elif hasattr(self, "id") and self.id:
+            return u'%s-%s' % (self.__class__.__name__, self.id)
+        else:
+            return u'%s-unsaved' % self.__class__.__name__
+
     def get_content_type_key(self):
         ct = ContentType.objects.get_for_model(self.__class__)
         return "%s.%s" % (ct.app_label, ct.model)