Adjustments for initial public launch of OpenCloud
diff --git a/planetstack/core/models/site.py b/planetstack/core/models/site.py
index 56f9bd0..caf5afb 100644
--- a/planetstack/core/models/site.py
+++ b/planetstack/core/models/site.py
@@ -1,13 +1,15 @@
import os
from django.db import models
from core.models import PlCoreBase
-from core.models import Deployment
+#from core.models import Deployment
from core.models import Tag
from django.contrib.contenttypes import generic
from geoposition.fields import GeopositionField
class Site(PlCoreBase):
-
+ """
+ A logical grouping of Nodes that are co-located at the same geographic location, which also typically corresponds to the Nodes' location in the physical network.
+ """
tenant_id = models.CharField(null=True, blank=True, 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")
@@ -19,16 +21,16 @@
is_public = models.BooleanField(default=True, help_text="Indicates the visibility of this site to other members")
abbreviated_name = models.CharField(max_length=80)
- deployments = models.ManyToManyField(Deployment, blank=True, related_name='sites')
+ deployments = models.ManyToManyField('Deployment', blank=True)
+ #deployments = models.ManyToManyField('Deployment', through='SiteDeployments', blank=True)
tags = generic.GenericRelation(Tag)
def __unicode__(self): return u'%s' % (self.name)
class SiteRole(PlCoreBase):
- ROLE_CHOICES = (('admin','Admin'),('pi','PI'),('tech','Tech'),('billing','Billing'), ('user', 'User'))
+ ROLE_CHOICES = (('admin','Admin'),('pi','PI'),('tech','Tech'),('billing','Billing'))
role = models.CharField(choices=ROLE_CHOICES, unique=True, max_length=30)
- krole_id = models.CharField(max_length=80, verbose_name="Keystone role id", null=True, blank=True)
def __unicode__(self): return u'%s' % (self.role)
@@ -46,4 +48,33 @@
def delete(self, *args, **kwds):
super(SitePrivilege, self).delete(*args, **kwds)
+class Deployment(PlCoreBase):
+ name = models.CharField(max_length=200, unique=True, help_text="Name of the Deployment")
+ #sites = models.ManyToManyField('Site', through='SiteDeployments', blank=True)
+
+ def __unicode__(self): return u'%s' % (self.name)
+
+
+class DeploymentRole(PlCoreBase):
+
+ ROLE_CHOICES = (('admin','Admin'),)
+ role = models.CharField(choices=ROLE_CHOICES, unique=True, max_length=30)
+
+ def __unicode__(self): return u'%s' % (self.role)
+
+class DeploymentPrivilege(PlCoreBase):
+
+ user = models.ForeignKey('User', related_name='deployment_privileges')
+ deployment = models.ForeignKey('Deployment', related_name='deployment_privileges')
+ role = models.ForeignKey('DeploymentRole')
+
+ def __unicode__(self): return u'%s %s %s' % (self.deployment, self.user, self.role)
+
+class SiteDeployments(PlCoreBase):
+ site = models.ForeignKey(Site)
+ deployment = models.ForeignKey(Deployment)
+
+ class Meta:
+ db_table = 'site_deployments'
+ #auto_created = Site