This change renamed a number of misnamed related fields (e.g. site_privileges->siteprivileges), adds them where they are missing, and changes the corresponding accessors.
diff --git a/planetstack/core/models/flavor.py b/planetstack/core/models/flavor.py
index 04747af..20002dd 100644
--- a/planetstack/core/models/flavor.py
+++ b/planetstack/core/models/flavor.py
@@ -29,7 +29,7 @@
def __unicode__(self): return u'%s' % (self.name)
class FlavorParameter(PlCoreBase):
- parameter = models.ForeignKey(FlavorParameterType, related_name="parameters", help_text="The type of the parameter")
+ parameter = models.ForeignKey(FlavorParameterType, related_name="flavorparameters", help_text="The type of the parameter")
value = models.CharField(help_text="The value of this parameter", max_length=1024)
flavor = models.ForeignKey(Flavor,related_name='flavorparameter')
diff --git a/planetstack/core/models/network.py b/planetstack/core/models/network.py
index ee239a7..02650e1 100644
--- a/planetstack/core/models/network.py
+++ b/planetstack/core/models/network.py
@@ -125,8 +125,8 @@
deleted_objects = DeploymentLinkDeletionManager()
# Stores the openstack ids at various deployments
- network = models.ForeignKey(Network)
- deployment = models.ForeignKey(Deployment)
+ network = models.ForeignKey(Network, related_name='networkdeployments')
+ deployment = models.ForeignKey(Deployment, related_name='networkdeployments')
net_id = models.CharField(null=True, blank=True, max_length=256, help_text="Quantum network")
router_id = models.CharField(null=True, blank=True, max_length=256, help_text="Quantum router id")
subnet_id = models.CharField(null=True, blank=True, max_length=256, help_text="Quantum subnet id")
@@ -149,8 +149,8 @@
# This object exists solely so we can implement the permission check when
# adding slices to networks. It adds no additional fields to the relation.
- network = models.ForeignKey(Network)
- slice = models.ForeignKey(Slice)
+ network = models.ForeignKey(Network,related_name='networkslices')
+ slice = models.ForeignKey(Slice,related_name='networkslices')
def save(self, *args, **kwds):
slice = self.slice
@@ -178,8 +178,8 @@
return qs
class NetworkSliver(PlCoreBase):
- network = models.ForeignKey(Network)
- sliver = models.ForeignKey(Sliver)
+ network = models.ForeignKey(Network,relatedname='networkslivers')
+ sliver = models.ForeignKey(Sliver,relatedname='networkslivers')
ip = models.GenericIPAddressField(help_text="Sliver ip address", blank=True, null=True)
port_id = models.CharField(null=True, blank=True, max_length=256, help_text="Quantum port id")
@@ -227,7 +227,7 @@
def __unicode__(self): return u'%s' % (self.name)
class NetworkParameter(PlCoreBase):
- parameter = models.ForeignKey(NetworkParameterType, related_name="parameters", help_text="The type of the parameter")
+ parameter = models.ForeignKey(NetworkParameterType, related_name="networkparameters", help_text="The type of the parameter")
value = models.CharField(help_text="The value of this parameter", max_length=1024)
# The required fields to do a ObjectType lookup, and object_id assignment
diff --git a/planetstack/core/models/planetstackspecific.py b/planetstack/core/models/planetstackspecific.py
index 9007a51..2102a6e 100644
--- a/planetstack/core/models/planetstackspecific.py
+++ b/planetstack/core/models/planetstackspecific.py
@@ -20,8 +20,8 @@
def __unicode__(self): return u'%s' % (self.role)
class PlanetStackPrivilege(PlCoreBase):
- user = models.ForeignKey('User', related_name='planetstack_privileges')
- planetstack = models.ForeignKey('PlanetStack', related_name='planetstack_privileges', default=1)
+ user = models.ForeignKey('User', related_name='planetstackprivileges')
+ planetstack = models.ForeignKey('PlanetStack', related_name='planetstackprivileges', default=1)
role = models.ForeignKey('PlanetStackRole')
def __unicode__(self): return u'%s %s %s' % (self.planetstack, self.user, self.role)
diff --git a/planetstack/core/models/reservation.py b/planetstack/core/models/reservation.py
index db3769f..4dd1274 100644
--- a/planetstack/core/models/reservation.py
+++ b/planetstack/core/models/reservation.py
@@ -32,10 +32,10 @@
return qs
class ReservedResource(PlCoreBase):
- sliver = models.ForeignKey(Sliver, related_name="reservedResourrces")
- resource = models.ForeignKey(ServiceResource, related_name="reservedResources")
+ sliver = models.ForeignKey(Sliver, related_name="reservedresources")
+ resource = models.ForeignKey(ServiceResource, related_name="reservedresources")
quantity = models.IntegerField(default=1)
- reservationSet = models.ForeignKey(Reservation, related_name="reservedResources")
+ reservationSet = models.ForeignKey(Reservation, related_name="reservedresources")
class Meta(PlCoreBase.Meta):
verbose_name_plural = "Reserved Resources"
diff --git a/planetstack/core/models/serviceresource.py b/planetstack/core/models/serviceresource.py
index e849425..2f88dc9 100644
--- a/planetstack/core/models/serviceresource.py
+++ b/planetstack/core/models/serviceresource.py
@@ -8,7 +8,7 @@
# Create your models here.
class ServiceResource(PlCoreBase):
- serviceClass = models.ForeignKey(ServiceClass, related_name = "resources")
+ serviceClass = models.ForeignKey(ServiceClass, related_name = "serviceresources")
name = models.CharField(max_length=32)
maxUnitsDeployment = models.IntegerField(default=1)
maxUnitsNode = models.IntegerField(default=1)
diff --git a/planetstack/core/models/site.py b/planetstack/core/models/site.py
index f562b92..09eb786 100644
--- a/planetstack/core/models/site.py
+++ b/planetstack/core/models/site.py
@@ -141,9 +141,9 @@
class SitePrivilege(PlCoreBase):
- user = models.ForeignKey('User', related_name='site_privileges')
- site = models.ForeignKey('Site', related_name='site_privileges')
- role = models.ForeignKey('SiteRole')
+ user = models.ForeignKey('User', related_name='siteprivileges')
+ site = models.ForeignKey('Site', related_name='siteprivileges')
+ role = models.ForeignKey('SiteRole',related_name='siteprivileges')
def __unicode__(self): return u'%s %s %s' % (self.site, self.user, self.role)
@@ -229,9 +229,9 @@
objects = DeploymentLinkManager()
deleted_objects = DeploymentLinkDeletionManager()
- user = models.ForeignKey('User', related_name='deployment_privileges')
- deployment = models.ForeignKey('Deployment', related_name='deployment_privileges')
- role = models.ForeignKey('DeploymentRole')
+ user = models.ForeignKey('User', related_name='deploymentprivileges')
+ deployment = models.ForeignKey('Deployment', related_name='deploymentprivileges')
+ role = models.ForeignKey('DeploymentRole',related_name='deploymentprivileges')
def __unicode__(self): return u'%s %s %s' % (self.deployment, self.user, self.role)
diff --git a/planetstack/core/models/slice.py b/planetstack/core/models/slice.py
index e1fad4c..d438bdf 100644
--- a/planetstack/core/models/slice.py
+++ b/planetstack/core/models/slice.py
@@ -102,9 +102,9 @@
def __unicode__(self): return u'%s' % (self.role)
class SlicePrivilege(PlCoreBase):
- user = models.ForeignKey('User', related_name='slice_privileges')
- slice = models.ForeignKey('Slice', related_name='slice_privileges')
- role = models.ForeignKey('SliceRole')
+ user = models.ForeignKey('User', related_name='sliceprivileges')
+ slice = models.ForeignKey('Slice', related_name='sliceprivileges')
+ role = models.ForeignKey('SliceRole',related_name='sliceprivileges')
def __unicode__(self): return u'%s %s %s' % (self.slice, self.user, self.role)
diff --git a/planetstack/core/models/user.py b/planetstack/core/models/user.py
index a935d22..7063f4f 100644
--- a/planetstack/core/models/user.py
+++ b/planetstack/core/models/user.py
@@ -183,7 +183,7 @@
def get_dashboards(self):
DEFAULT_DASHBOARDS=["Tenant"]
- dashboards = sorted(list(self.dashboardViews.all()), key=attrgetter('order'))
+ dashboards = sorted(list(self.userdashboardviews.all()), key=attrgetter('order'))
dashboards = [x.dashboardView for x in dashboards]
if not dashboards:
@@ -285,6 +285,6 @@
self.delete(*args, **kwds)
class UserDashboardView(PlCoreBase):
- user = models.ForeignKey(User, related_name="dashboardViews")
- dashboardView = models.ForeignKey(DashboardView, related_name="dashboardViews")
+ user = models.ForeignKey(User, related_name='userdashboardviews')
+ dashboardView = models.ForeignKey(DashboardView, related_name='userdashboardviews')
order = models.IntegerField(default=0)
diff --git a/planetstack/core/models/userdeployments.py b/planetstack/core/models/userdeployments.py
index 6cc2643..d0337ba 100644
--- a/planetstack/core/models/userdeployments.py
+++ b/planetstack/core/models/userdeployments.py
@@ -6,12 +6,12 @@
from core.models import PlCoreBase,Site,User,Deployment
from core.models import Deployment,DeploymentLinkManager,DeploymentLinkDeletionManager
-class UserDeployments(PlCoreBase):
+class UserDeployment(PlCoreBase):
objects = DeploymentLinkManager()
deleted_objects = DeploymentLinkDeletionManager()
- user = models.ForeignKey(User)
- deployment = models.ForeignKey(Deployment)
+ user = models.ForeignKey(User,related_name='userdeployments')
+ deployment = models.ForeignKey(Deployment,related_name='userdeployments')
kuser_id = models.CharField(null=True, blank=True, max_length=200, help_text="Keystone user id")
def __unicode__(self): return u'%s %s' % (self.user, self.deployment.name)