remove sliver.name field from admin page. generate sliver.name for user when it isn't specified
diff --git a/plstackapi/core/admin.py b/plstackapi/core/admin.py
index d0b83e7..ebb1e58 100644
--- a/plstackapi/core/admin.py
+++ b/plstackapi/core/admin.py
@@ -271,9 +271,9 @@
class SliverAdmin(PlanetStackBaseAdmin):
form = SliverForm
fieldsets = [
- ('Sliver', {'fields': ['ip', 'instance_name', 'name', 'slice', 'numberCores', 'image', 'key', 'node', 'deploymentNetwork']})
+ ('Sliver', {'fields': ['ip', 'instance_name', 'slice', 'numberCores', 'image', 'key', 'node', 'deploymentNetwork']})
]
- list_display = ['ip', 'instance_name', 'name', 'slice', 'numberCores', 'image', 'key', 'node', 'deploymentNetwork']
+ list_display = ['ip', 'instance_name', 'slice', 'numberCores', 'image', 'key', 'node', 'deploymentNetwork']
def save_model(self, request, obj, form, change):
# update openstack connection to use this site/tenant
diff --git a/plstackapi/core/models/sliver.py b/plstackapi/core/models/sliver.py
index 52420df..ef4e647 100644
--- a/plstackapi/core/models/sliver.py
+++ b/plstackapi/core/models/sliver.py
@@ -30,6 +30,8 @@
raise exceptions.ValidationError, "Slice %s has no subnet" % self.slice.name
self.os_manager.save_sliver(self)
+ if not self.name:
+ self.name = self.slice.name
super(Sliver, self).save(*args, **kwds)
def delete(self, *args, **kwds):