HyperlinkedModelSerializer doesn't include the id by default
diff --git a/plstackapi/planetstack/models.py b/plstackapi/planetstack/models.py
index e796614..8ecc144 100644
--- a/plstackapi/planetstack/models.py
+++ b/plstackapi/planetstack/models.py
@@ -34,7 +34,7 @@
super(Role, self).save()
class Site(PlCoreBase):
- tenant_id = models.CharField(max_length=200, help_text="Keystone tenant id")
+ site_id = models.CharField(max_length=200, help_text="Keystone tenant id")
name = models.CharField(max_length=200, help_text="Name for this Site")
site_url = models.URLField(null=True, blank=True, max_length=512, help_text="Site's Home URL Page")
enabled = models.BooleanField(default=True, help_text="Status for this Site")
diff --git a/plstackapi/planetstack/serializers.py b/plstackapi/planetstack/serializers.py
index d4bbc94..81a4ba8 100644
--- a/plstackapi/planetstack/serializers.py
+++ b/plstackapi/planetstack/serializers.py
@@ -4,7 +4,9 @@
class RoleSerializer(serializers.HyperlinkedModelSerializer):
-
+ # HyperlinkedModelSerializer doesn't include the id by default
+ id = serializers.Field()
+
class Meta:
model = Role
fields = ('id',
@@ -13,6 +15,8 @@
class UserSerializer(serializers.HyperlinkedModelSerializer):
+ # HyperlinkedModelSerializer doesn't include the id by default
+ id = serializers.Field()
site = serializers.HyperlinkedRelatedField(view_name='site-detail')
slice_memberships = serializers.HyperlinkedRelatedField(view_name='slice-membership-detail')
site_privileges = serializers.HyperlinkedRelatedField(view_name='site-privilege-detail')
@@ -33,7 +37,8 @@
class SliceSerializer(serializers.HyperlinkedModelSerializer):
-
+ # HyperlinkedModelSerializer doesn't include the id by default
+ id = serializers.Field()
site = serializers.HyperlinkedRelatedField(view_name='site-detail')
class Meta:
@@ -55,6 +60,8 @@
#slices = serializers.PrimaryKeyRelatedField(many=True, read_only=True)
#slices = serializers.RelatedField(many=True, read_only=True)
#slices = SliceSerializer(many=True)
+ # HyperlinkedModelSerializer doesn't include the id by default
+ id = serializers.Field()
slices = serializers.HyperlinkedRelatedField(many=True, read_only=True,view_name='slice-detail')
deployment_networks = serializers.HyperlinkedRelatedField(many=True, read_only=True,view_name='sitedeploymentnetwork-detail')
@@ -78,6 +85,8 @@
class DeploymentNetworkSerializer(serializers.HyperlinkedModelSerializer):
+ # HyperlinkedModelSerializer doesn't include the id by default
+ id = serializers.Field()
sites = serializers.HyperlinkedRelatedField(view_name='sitedeploymentnetwork-detail')
class Meta:
model = DeploymentNetwork
@@ -87,17 +96,21 @@
)
class SiteDeploymentNetworkSerializer(serializers.HyperlinkedModelSerializer):
-
+ # HyperlinkedModelSerializer doesn't include the id by default
+ id = serializers.Field()
site = serializers.HyperlinkedRelatedField(view_name='site-detail')
deploymentNetwork = serializers.HyperlinkedRelatedField(view_name='deploymentnetwork-detail')
class Meta:
model = SiteDeploymentNetwork
- fields = ('url',
+ fields = ('id',
+ 'url',
'site',
'deploymentNetwork')
-class SliverSerializer(serializers.ModelSerializer):
+class SliverSerializer(serializers.HyperlinkedModelSerializer):
+ # HyperlinkedModelSerializer doesn't include the id by default
+ id = serializers.Field()
slice = serializers.RelatedField(read_only=True)
#slice = serializers.PrimaryKeyRelatedField(read_only=True)
@@ -107,15 +120,17 @@
'slice',
'name')
-class NodeSerializer(serializers.ModelSerializer):
-
+class NodeSerializer(serializers.HyperlinkedModelSerializer):
+ # HyperlinkedModelSerializer doesn't include the id by default
+ id = serializers.Field()
class Meta:
model = Node
fields = ('id',
'name')
-class ImageSerializer(serializers.ModelSerializer):
-
+class ImageSerializer(serializers.HyperlinkedModelSerializer):
+ # HyperlinkedModelSerializer doesn't include the id by default
+ id = serializers.Field()
class Meta:
model = Image
fields = ('id',
@@ -124,8 +139,9 @@
'disk_format',
'container_format')
-class FlavorSerializer(serializers.ModelSerializer):
-
+class FlavorSerializer(serializers.HyperlinkedModelSerializer):
+ # HyperlinkedModelSerializer doesn't include the id by default
+ id = serializers.Field()
class Meta:
model = Flavor
fields = ('id',
@@ -137,6 +153,7 @@
serializerLookUp = {
Role: RoleSerializer,
+ User: UserSerializer,
Site: SiteSerializer,
Slice: SliceSerializer,
Node: NodeSerializer,