rename camelcase fields in slice
Scott Baker [Sun, 4 Jan 2015 00:26:38 +0000 (16:26 -0800)]
planetstack/core/dashboard/views/tenant.py
planetstack/core/fixtures/initial_data.json
planetstack/core/models/slice.py
planetstack/core/xoslib/methods/sliceplus.py

index 02f388a..762409e 100644 (file)
@@ -52,7 +52,7 @@ class TenantCreateSlice(View):
            serviceClass = ServiceClass.objects.get(name=serviceClass)
            site = request.user.site
            image = Image.objects.get(name=imageName)
-           newSlice = Slice(name=sliceName,serviceClass=serviceClass,site=site,imagePreference=image,mountDataSets=mountDataSets)
+           newSlice = Slice(name=sliceName,serviceClass=serviceClass,site=site,image_preference=image,mount_data_sets=mountDataSets)
            newSlice.save()
           privateTemplate="Private"
           publicTemplate="Public shared IPv4"\r
@@ -103,8 +103,8 @@ class TenantUpdateSlice(View):
                 if(entry.name==sliceName):\r
                          if (actionToDo == "update"):\r
                                 setattr(entry,'serviceClass',serviceClass)\r
-                                setattr(entry,'imagePreference',imageName)\r
-                                setattr(entry,'mountDataSets',dataSet)\r
+                                setattr(entry,'image_preference',imageName)\r
+                                setattr(entry,'mount_data_sets',dataSet)\r
                                 entry.save()\r
                                 break\r
        addOrModifyPorts(networkPorts,sliceName)\r
@@ -179,8 +179,8 @@ def getTenantInfo(user):
            sliceName = Slice.objects.get(id=entry.id).name
            slice = Slice.objects.get(name=Slice.objects.get(id=entry.id).name)
            sliceServiceClass = entry.serviceClass.name
-           preferredImage =  entry.imagePreference
-           #sliceDataSet = entry.mountDataSets
+           preferredImage =  entry.image_preference
+           #sliceDataSet = entry.mount_data_sets
            sliceNetwork = {}
            numSliver = 0
            sliceImage=""
index 516f216..5906936 100644 (file)
         "omf_friendly": false,
         "network": null,
         "max_slivers": 10,
-        "mountDataSets": null,
+        "mount_data_sets": null,
         "backend_status": "Provisioning in progress",
         "creator": 7,
         "enacted": "2014-09-19T21:20:35.271Z"
         "omf_friendly": false,
         "network": null,
         "max_slivers": 10,
-        "mountDataSets": null,
+        "mount_data_sets": null,
         "backend_status": "Provisioning in progress",
         "creator": 7,
         "enacted": "2014-10-09T18:47:35.832Z"
         "omf_friendly": false,
         "network": "Private Only",
         "max_slivers": 100,
-        "mountDataSets": "GenBank",
+        "mount_data_sets": "GenBank",
         "backend_status": "Provisioning in progress",
         "creator": 6,
         "enacted": "2014-10-09T18:48:00.386Z"
         "omf_friendly": false,
         "network": "Private Only",
         "max_slivers": 10,
-        "mountDataSets": "GenBank",
+        "mount_data_sets": "GenBank",
         "backend_status": "Provisioning in progress",
         "creator": 8,
         "enacted": "2014-09-23T19:06:55.420Z"
         "omf_friendly": false,
         "network": "Private Only",
         "max_slivers": 10,
-        "mountDataSets": "GenBank",
+        "mount_data_sets": "GenBank",
         "backend_status": "",
         "creator": 8,
         "enacted": "2014-09-19T21:20:04.708Z"
         "omf_friendly": false,
         "network": "Private Only",
         "max_slivers": 10,
-        "mountDataSets": "GenBank",
+        "mount_data_sets": "GenBank",
         "backend_status": "Provisioning in progress",
         "creator": 8,
         "enacted": "2014-09-30T22:43:42.489Z"
         "omf_friendly": false,
         "network": "Private Only",
         "max_slivers": 10,
-        "mountDataSets": "GenBank",
+        "mount_data_sets": "GenBank",
         "backend_status": "NameError(\"global name 'User' is not defined\",)",
         "creator": null,
         "enacted": null
         "omf_friendly": false,
         "network": "Private Only",
         "max_slivers": 10,
-        "mountDataSets": "GenBank",
+        "mount_data_sets": "GenBank",
         "backend_status": "NameError(\"global name 'User' is not defined\",)",
         "creator": null,
         "enacted": null
         "omf_friendly": false,
         "network": "Private Only",
         "max_slivers": 10,
-        "mountDataSets": "GenBank",
+        "mount_data_sets": "GenBank",
         "backend_status": "NameError(\"global name 'User' is not defined\",)",
         "creator": null,
         "enacted": null
         "omf_friendly": false,
         "network": "Private Only",
         "max_slivers": 10,
-        "mountDataSets": "GenBank",
+        "mount_data_sets": "GenBank",
         "backend_status": "Provisioning in progress",
         "creator": 6,
         "enacted": "2014-10-10T14:57:41.282Z"
         "omf_friendly": false,
         "network": "Private Only",
         "max_slivers": 10,
-        "mountDataSets": "GenBank",
+        "mount_data_sets": "GenBank",
         "backend_status": "NameError(\"global name 'User' is not defined\",)",
         "creator": 8,
         "enacted": null
index 8854a75..52a5dd6 100644 (file)
@@ -24,15 +24,16 @@ class Slice(PlCoreBase):
     slice_url = models.URLField(blank=True, max_length=512)
     site = models.ForeignKey(Site, related_name='slices', help_text="The Site this Slice belongs to")
     max_slivers = models.IntegerField(default=10)
-    imagePreference = models.CharField(default="Ubuntu 12.04 LTS", null=True, blank=True, max_length=256)
     service = models.ForeignKey(Service, related_name='service', null=True, blank=True)
     network = models.CharField(default="Private Only",null=True, blank=True, max_length=256)
-    mountDataSets = models.CharField(default="GenBank",null=True, blank=True, max_length=256)
     tags = generic.GenericRelation(Tag)
-
     serviceClass = models.ForeignKey(ServiceClass, related_name = "slices", null=True, default=get_default_serviceclass)
     creator = models.ForeignKey(User, related_name='slices', blank=True, null=True)
 
+    # for tenant view
+    image_preference = models.CharField(default="Ubuntu 12.04 LTS", null=True, blank=True, max_length=256)
+    mount_data_sets = models.CharField(default="GenBank",null=True, blank=True, max_length=256)
+
     def __unicode__(self):  return u'%s' % (self.name)
 
     @property
index 7e9ae89..48102df 100644 (file)
@@ -32,7 +32,7 @@ class SlicePlusIdSerializer(serializers.ModelSerializer, PlusSerializerMixin):
 \r
         class Meta:\r
             model = SlicePlus\r
-            fields = ('humanReadableName', 'id','created','updated','enacted','name','enabled','omf_friendly','description','slice_url','site','max_slivers','imagePreference','service','network','mountDataSets','serviceClass','creator','networks','availableNetworks','sliceInfo','backendIcon','backendHtml')
+            fields = ('humanReadableName', 'id','created','updated','enacted','name','enabled','omf_friendly','description','slice_url','site','max_slivers','image_preference','service','network','mount_data_sets','serviceClass','creator','networks','availableNetworks','sliceInfo','backendIcon','backendHtml')
 
 class SlicePlusList(generics.ListCreateAPIView):
     queryset = SlicePlus.objects.select_related().all()