replace django.db.models.CharField with core.models.plcorebase.StrippedCharField
diff --git a/xos/core/models/billing.py b/xos/core/models/billing.py
index 8c61418..765e42f 100644
--- a/xos/core/models/billing.py
+++ b/xos/core/models/billing.py
@@ -3,6 +3,7 @@
import socket
from django.db import models
from core.models import PlCoreBase, Site, Slice, Sliver, Deployment
+from core.models.plcorebase import StrippedCharField
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.db.models import Sum
@@ -45,7 +46,7 @@
def __unicode__(self): return u'%s-%s' % (self.account.site.name, str(self.date))
class UsableObject(PlCoreBase):
- name = models.CharField(max_length=1024)
+ name = StrippedCharField(max_length=1024)
def __unicode__(self): return u'%s' % (self.name)
@@ -62,8 +63,8 @@
account = models.ForeignKey(Account, related_name="charges")
slice = models.ForeignKey(Slice, related_name="charges", null=True, blank=True)
- kind = models.CharField(max_length=30, choices=KIND_CHOICES, default="besteffort")
- state = models.CharField(max_length=30, choices=STATE_CHOICES, default="pending")
+ kind = StrippedCharField(max_length=30, choices=KIND_CHOICES, default="besteffort")
+ state = StrippedCharField(max_length=30, choices=STATE_CHOICES, default="pending")
date = models.DateTimeField()
object = models.ForeignKey(UsableObject)
amount = models.FloatField(default=0.0)
diff --git a/xos/core/models/controlleruser.py b/xos/core/models/controlleruser.py
index b3ba720..b950901 100644
--- a/xos/core/models/controlleruser.py
+++ b/xos/core/models/controlleruser.py
@@ -4,6 +4,7 @@
from django.db import models
from django.db.models import F, Q
from core.models import PlCoreBase,User,Controller
+from core.models.plcorebase import StrippedCharField
from core.models import Controller,ControllerLinkManager,ControllerLinkDeletionManager
class ControllerUser(PlCoreBase):
@@ -12,7 +13,7 @@
user = models.ForeignKey(User,related_name='controllerusers')
controller = models.ForeignKey(Controller,related_name='controllersusers')
- kuser_id = models.CharField(null=True, blank=True, max_length=200, help_text="Keystone user id")
+ kuser_id = StrippedCharField(null=True, blank=True, max_length=200, help_text="Keystone user id")
def __unicode__(self): return u'%s %s' % (self.controller, self.user)
@@ -35,7 +36,7 @@
controller = models.ForeignKey('Controller', related_name='controllersiteprivileges')
site_privilege = models.ForeignKey('SitePrivilege', related_name='controllersiteprivileges')
- role_id = models.CharField(null=True, blank=True, max_length=200, db_index=True, help_text="Keystone id")
+ role_id = StrippedCharField(null=True, blank=True, max_length=200, db_index=True, help_text="Keystone id")
def __unicode__(self): return u'%s %s' % (self.controller, self.site_privilege)
@@ -66,7 +67,7 @@
controller = models.ForeignKey('Controller', related_name='controllersliceprivileges')
slice_privilege = models.ForeignKey('SlicePrivilege', related_name='controllersliceprivileges')
- role_id = models.CharField(null=True, blank=True, max_length=200, db_index=True, help_text="Keystone id")
+ role_id = StrippedCharField(null=True, blank=True, max_length=200, db_index=True, help_text="Keystone id")
def __unicode__(self): return u'%s %s' % (self.controller, self.slice_privilege)
diff --git a/xos/core/models/credential.py b/xos/core/models/credential.py
index 0f80bb8..0dfe74c 100644
--- a/xos/core/models/credential.py
+++ b/xos/core/models/credential.py
@@ -2,6 +2,7 @@
from django.db import models
from core.models import PlCoreBase
from core.models import User,Site,Slice,Controller
+from core.models.plcorebase import StrippedCharField
from encrypted_fields import EncryptedCharField
from core.models import Controller,ControllerLinkManager,ControllerLinkDeletionManager
@@ -9,7 +10,7 @@
user = models.ForeignKey(User, related_name='usercredentials', help_text="The User this credential is associated with")
name = models.SlugField(help_text="The credential type, e.g. ec2", max_length=128)
- key_id = models.CharField(help_text="The backend id of this credential", max_length=1024)
+ key_id = StrippedCharField(help_text="The backend id of this credential", max_length=1024)
enc_value = EncryptedCharField(help_text="The key value of this credential", max_length=1024)
@@ -20,7 +21,7 @@
site = models.ForeignKey(Site, related_name='sitecredentials', help_text="The User this credential is associated with")
name = models.SlugField(help_text="The credential type, e.g. ec2", max_length=128)
- key_id = models.CharField(help_text="The backend id of this credential", max_length=1024)
+ key_id = SrippedCharField(help_text="The backend id of this credential", max_length=1024)
enc_value = EncryptedCharField(help_text="The key value of this credential", max_length=1024)
@@ -31,7 +32,7 @@
slice = models.ForeignKey(Slice, related_name='slicecredentials', help_text="The User this credential is associated with")
name = models.SlugField(help_text="The credential type, e.g. ec2", max_length=128)
- key_id = models.CharField(help_text="The backend id of this credential", max_length=1024)
+ key_id = StrippedCharField(help_text="The backend id of this credential", max_length=1024)
enc_value = EncryptedCharField(help_text="The key value of this credential", max_length=1024)
diff --git a/xos/core/models/dashboard.py b/xos/core/models/dashboard.py
index 328a2ba..5228381 100644
--- a/xos/core/models/dashboard.py
+++ b/xos/core/models/dashboard.py
@@ -1,12 +1,13 @@
import os
from django.db import models
from core.models import PlCoreBase, Controller, Deployment
+from core.models.plcorebase import StrippedCharField
from core.models.site import ControllerLinkManager, ControllerLinkDeletionManager
from django.contrib.contenttypes import generic
class DashboardView(PlCoreBase):
- name = models.CharField(max_length=200, unique=True, help_text="Name of the View")
- url = models.CharField(max_length=1024, help_text="URL of Dashboard")
+ name = StrippedCharField(max_length=200, unique=True, help_text="Name of the View")
+ url = StrippedCharField(max_length=1024, help_text="URL of Dashboard")
controllers = models.ManyToManyField(Controller, blank=True, related_name="dashboardviews", through='ControllerDashboardView')
enabled = models.BooleanField(default=True)
deployments = models.ManyToManyField(Deployment, blank=True, null=True, related_name="dashboardviews", help_text="Deployments that should be included in this view")
@@ -20,7 +21,7 @@
dashboardView = models.ForeignKey(DashboardView, related_name='controllerdashboardviews')
enabled = models.BooleanField(default=True)
- url = models.CharField(max_length=1024, help_text="URL of Dashboard")
+ url = StrippedCharField(max_length=1024, help_text="URL of Dashboard")
diff --git a/xos/core/models/flavor.py b/xos/core/models/flavor.py
index 20002dd..3d6b9bb 100644
--- a/xos/core/models/flavor.py
+++ b/xos/core/models/flavor.py
@@ -2,13 +2,14 @@
import socket
from django.db import models
from core.models import PlCoreBase, Deployment
+from core.models.plcorebase import StrippedCharField
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
class Flavor(PlCoreBase):
- name = models.CharField(max_length=32, help_text="name of this flavor, as displayed to users")
- description = models.CharField(max_length=1024, blank=True, null=True)
- flavor = models.CharField(max_length=32, help_text="flavor string used to configure deployments")
+ name = StrippedCharField(max_length=32, help_text="name of this flavor, as displayed to users")
+ description = StrippedCharField(max_length=1024, blank=True, null=True)
+ flavor = StrippedCharField(max_length=32, help_text="flavor string used to configure deployments")
deployments = models.ManyToManyField(Deployment, blank=True, related_name="flavors")
order = models.IntegerField(default=0, help_text="used to order flavors when displayed in a list")
default = models.BooleanField(default=False, help_text="make this a default flavor to use when creating new instances")
@@ -24,13 +25,13 @@
class FlavorParameterType(PlCoreBase):
name = models.SlugField(help_text="The name of this parameter", max_length=128)
- description = models.CharField(max_length=1024)
+ description = StrippedCharField(max_length=1024)
def __unicode__(self): return u'%s' % (self.name)
class FlavorParameter(PlCoreBase):
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)
+ value = StrippedCharField(help_text="The value of this parameter", max_length=1024)
flavor = models.ForeignKey(Flavor,related_name='flavorparameter')
diff --git a/xos/core/models/image.py b/xos/core/models/image.py
index 8d392a3..b2123f8 100644
--- a/xos/core/models/image.py
+++ b/xos/core/models/image.py
@@ -1,15 +1,16 @@
import os
from django.db import models
from core.models import PlCoreBase
+from core.models.plcorebase import StrippedCharField
from core.models import Deployment, DeploymentPrivilege, Controller,ControllerLinkManager,ControllerLinkDeletionManager
# Create your models here.
class Image(PlCoreBase):
- name = models.CharField(max_length=256, unique=True)
- disk_format = models.CharField(max_length=256)
- container_format = models.CharField(max_length=256)
- path = models.CharField(max_length=256, null=True, blank=True, help_text="Path to image on local disk")
+ name = StrippedCharField(max_length=256, unique=True)
+ disk_format = StrippedCharField(max_length=256)
+ container_format = StrippedCharField(max_length=256)
+ path = StrippedCharField(max_length=256, null=True, blank=True, help_text="Path to image on local disk")
deployments = models.ManyToManyField('Deployment', through='ImageDeployments', blank=True, help_text="Select which images should be instantiated on this deployment", related_name='images')
def __unicode__(self): return u'%s' % (self.name)
@@ -28,6 +29,6 @@
deleted_objects = ControllerLinkDeletionManager()
image = models.ForeignKey(Image,related_name='controllerimages')
controller = models.ForeignKey(Controller,related_name='controllerimages')
- glance_image_id = models.CharField(null=True, blank=True, max_length=200, help_text="Glance image id")
+ glance_image_id = StrippedCharField(null=True, blank=True, max_length=200, help_text="Glance image id")
def __unicode__(self): return u'%s %s' % (self.image, self.controller)
diff --git a/xos/core/models/node.py b/xos/core/models/node.py
index bb4fe24..ec67975 100644
--- a/xos/core/models/node.py
+++ b/xos/core/models/node.py
@@ -1,6 +1,7 @@
import os
from django.db import models
from core.models import PlCoreBase
+from core.models.plcorebase import StrippedCharField
from core.models import Site, SiteDeployment, SitePrivilege
from core.models import Tag
from django.contrib.contenttypes import generic
@@ -8,7 +9,7 @@
# Create your models here.
class Node(PlCoreBase):
- name = models.CharField(max_length=200, unique=True, help_text="Name of the Node")
+ name = StrippedCharField(max_length=200, unique=True, help_text="Name of the Node")
site_deployment = models.ForeignKey(SiteDeployment, related_name='nodes')
site = models.ForeignKey(Site, null=True, blank=True, related_name='nodes')
tags = generic.GenericRelation(Tag)
diff --git a/xos/core/models/project.py b/xos/core/models/project.py
index 9f1a863..9cc2927 100644
--- a/xos/core/models/project.py
+++ b/xos/core/models/project.py
@@ -1,11 +1,12 @@
import os
from django.db import models
from core.models import PlCoreBase
+from core.models.plcorebase import StrippedCharField
# Create your models here.
class Project(PlCoreBase):
- name = models.CharField(max_length=200, unique=True, help_text="Name of Project")
+ name = StrippedCharField(max_length=200, unique=True, help_text="Name of Project")
def __unicode__(self): return u'%s' % (self.name)
diff --git a/xos/core/models/role.py b/xos/core/models/role.py
index bd97f52..353139e 100644
--- a/xos/core/models/role.py
+++ b/xos/core/models/role.py
@@ -1,15 +1,16 @@
import os
import datetime
from django.db import models
-from core.models import PlCoreBase
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
+from core.models import PlCoreBase
+from core.models.plcorebase import StrippedCharField
class Role(PlCoreBase):
- role_type = models.CharField(max_length=80, verbose_name="Name")
- role = models.CharField(max_length=80, verbose_name="Keystone role id", null=True, blank=True)
- description = models.CharField(max_length=120, verbose_name="Description")
+ role_type = StrippedCharField(max_length=80, verbose_name="Name")
+ role = StrippedCharField(max_length=80, verbose_name="Keystone role id", null=True, blank=True)
+ description = StrippedCharField(max_length=120, verbose_name="Description")
content_type = models.ForeignKey(ContentType, verbose_name="Role Scope")
def __unicode__(self): return u'%s:%s' % (self.content_type,self.role_type)
diff --git a/xos/core/models/service.py b/xos/core/models/service.py
index f26bf06..979a295 100644
--- a/xos/core/models/service.py
+++ b/xos/core/models/service.py
@@ -1,20 +1,21 @@
-from core.models import PlCoreBase,SingletonModel
from django.db import models
+from core.models import PlCoreBase,SingletonModel
+from core.models.plcorebase import StrippedCharField
class Service(PlCoreBase):
description = models.TextField(max_length=254,null=True, blank=True,help_text="Description of Service")
enabled = models.BooleanField(default=True)
- name = models.CharField(max_length=30, help_text="Service Name")
- versionNumber = models.CharField(max_length=30, help_text="Version of Service Definition")
+ name = StrippedCharField(max_length=30, help_text="Service Name")
+ versionNumber = StrippedCharField(max_length=30, help_text="Version of Service Definition")
published = models.BooleanField(default=True)
- view_url = models.CharField(blank=True, null=True, max_length=1024)
- icon_url = models.CharField(blank=True, null=True, max_length=1024)
+ view_url = StrippedCharField(blank=True, null=True, max_length=1024)
+ icon_url = StrippedCharField(blank=True, null=True, max_length=1024)
def __unicode__(self): return u'%s' % (self.name)
class ServiceAttribute(PlCoreBase):
name = models.SlugField(help_text="Attribute Name", max_length=128)
- value = models.CharField(help_text="Attribute Value", max_length=1024)
+ value = StrippedCharField(help_text="Attribute Value", max_length=1024)
service = models.ForeignKey(Service, related_name='serviceattributes', help_text="The Service this attribute is associated with")
diff --git a/xos/core/models/serviceclass.py b/xos/core/models/serviceclass.py
index 4268568..ccc3180 100644
--- a/xos/core/models/serviceclass.py
+++ b/xos/core/models/serviceclass.py
@@ -1,6 +1,7 @@
import os
from django.db import models
from core.models import PlCoreBase
+from core.models.plcorebase import StrippedCharField
def get_default_serviceclass():
try:
@@ -9,8 +10,8 @@
return None
class ServiceClass(PlCoreBase):
- name = models.CharField(max_length=32)
- description = models.CharField(max_length=255)
+ name = StrippedCharField(max_length=32)
+ description = StrippedCharField(max_length=255)
commitment = models.IntegerField(default=365)
membershipFee = models.IntegerField(default=0)
membershipFeeMonths = models.IntegerField(default=12)
diff --git a/xos/core/models/serviceresource.py b/xos/core/models/serviceresource.py
index d5c86cd..416627a 100644
--- a/xos/core/models/serviceresource.py
+++ b/xos/core/models/serviceresource.py
@@ -2,12 +2,13 @@
from django.db import models
from core.models import PlCoreBase
from core.models import ServiceClass
+from core.models.plcorebase import StrippedCharField
# Create your models here.
class ServiceResource(PlCoreBase):
serviceClass = models.ForeignKey(ServiceClass, related_name = "serviceresources")
- name = models.CharField(max_length=32)
+ name = StrippedCharField(max_length=32)
maxUnitsDeployment = models.IntegerField(default=1)
maxUnitsNode = models.IntegerField(default=1)
maxDuration = models.IntegerField(default=1)
diff --git a/xos/core/models/site.py b/xos/core/models/site.py
index c0596f9..b26877d 100644
--- a/xos/core/models/site.py
+++ b/xos/core/models/site.py
@@ -1,10 +1,11 @@
import os
from django.db import models
from django.db.models import Q
-from core.models import PlCoreBase,PlCoreBaseManager,PlCoreBaseDeletionManager
-from core.models import Tag
from django.contrib.contenttypes import generic
from geoposition.fields import GeopositionField
+from core.models import PlCoreBase,PlCoreBaseManager,PlCoreBaseDeletionManager
+from core.models import Tag
+from core.models.plcorebase import StrippedCharField
from core.acl import AccessControlList
from xos.config import Config
@@ -94,15 +95,15 @@
"""
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.
"""
- name = models.CharField(max_length=200, help_text="Name for this Site")
+ name = StrippedCharField(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")
location = GeopositionField()
longitude = models.FloatField(null=True, blank=True)
latitude = models.FloatField(null=True, blank=True)
- login_base = models.CharField(max_length=50, unique=True, help_text="Prefix for Slices associated with this Site")
+ login_base = StrippedCharField(max_length=50, unique=True, help_text="Prefix for Slices associated with this Site")
is_public = models.BooleanField(default=True, help_text="Indicates the visibility of this site to other members")
- abbreviated_name = models.CharField(max_length=80)
+ abbreviated_name = StrippedCharField(max_length=80)
#deployments = models.ManyToManyField('Deployment', blank=True, related_name='sites')
deployments = models.ManyToManyField('Deployment', through='SiteDeployment', blank=True, help_text="Select which sites are allowed to host nodes in this deployment", related_name='sites')
@@ -116,7 +117,7 @@
class SiteRole(PlCoreBase):
ROLE_CHOICES = (('admin','Admin'),('pi','PI'),('tech','Tech'),('billing','Billing'))
- role = models.CharField(choices=ROLE_CHOICES, unique=True, max_length=30)
+ role = StrippedCharField(choices=ROLE_CHOICES, unique=True, max_length=30)
def __unicode__(self): return u'%s' % (self.role)
@@ -149,13 +150,13 @@
class Deployment(PlCoreBase):
#objects = Controllermanager()
#deleted_objects = DeploymentDeletionManager()
- name = models.CharField(max_length=200, unique=True, help_text="Name of the Deployment")
- #admin_user = models.CharField(max_length=200, null=True, blank=True, help_text="Username of an admin user at this deployment")
- #admin_password = models.CharField(max_length=200, null=True, blank=True, help_text="Password of theadmin user at this deployment")
- #admin_tenant = models.CharField(max_length=200, null=True, blank=True, help_text="Name of the tenant the admin user belongs to")
- #auth_url = models.CharField(max_length=200, null=True, blank=True, help_text="Auth url for the deployment")
- #backend_type = models.CharField(max_length=200, null=True, blank=True, help_text="Type of deployment, e.g. EC2, OpenStack, or OpenStack version")
- #availability_zone = models.CharField(max_length=200, null=True, blank=True, help_text="OpenStack availability zone")
+ name = StrippedCharField(max_length=200, unique=True, help_text="Name of the Deployment")
+ #admin_user = StrippedCharField(max_length=200, null=True, blank=True, help_text="Username of an admin user at this deployment")
+ #admin_password = StrippedCharField(max_length=200, null=True, blank=True, help_text="Password of theadmin user at this deployment")
+ #admin_tenant = StrippedCharField(max_length=200, null=True, blank=True, help_text="Name of the tenant the admin user belongs to")
+ #auth_url = StrippedCharField(max_length=200, null=True, blank=True, help_text="Auth url for the deployment")
+ #backend_type = StrippedCharField(max_length=200, null=True, blank=True, help_text="Type of deployment, e.g. EC2, OpenStack, or OpenStack version")
+ #availability_zone = StrippedCharField(max_length=200, null=True, blank=True, help_text="OpenStack availability zone")
# smbaker: the default of 'allow all' is intended for evolutions of existing
# deployments. When new deployments are created via the GUI, they are
@@ -204,7 +205,7 @@
#objects = DeploymentLinkManager()
#deleted_objects = DeploymentLinkDeletionManager()
ROLE_CHOICES = (('admin','Admin'),)
- role = models.CharField(choices=ROLE_CHOICES, unique=True, max_length=30)
+ role = StrippedCharField(choices=ROLE_CHOICES, unique=True, max_length=30)
def __unicode__(self): return u'%s' % (self.role)
@@ -235,7 +236,7 @@
#deleted_objects = ControllerLinkDeletionManager()
ROLE_CHOICES = (('admin','Admin'),)
- role = models.CharField(choices=ROLE_CHOICES, unique=True, max_length=30)
+ role = StrippedCharField(choices=ROLE_CHOICES, unique=True, max_length=30)
def __unicode__(self): return u'%s' % (self.role)
@@ -244,14 +245,14 @@
objects = ControllerManager()
deleted_objects = ControllerDeletionManager()
- name = models.CharField(max_length=200, unique=True, help_text="Name of the Controller")
- backend_type = models.CharField(max_length=200, help_text="Type of compute controller, e.g. EC2, OpenStack, or OpenStack version")
- version = models.CharField(max_length=200, help_text="Controller version")
- auth_url = models.CharField(max_length=200, null=True, blank=True, help_text="Auth url for the compute controller")
- admin_user = models.CharField(max_length=200, null=True, blank=True, help_text="Username of an admin user at this controller")
- admin_password = models.CharField(max_length=200, null=True, blank=True, help_text="Password of theadmin user at this controller")
- admin_tenant = models.CharField(max_length=200, null=True, blank=True, help_text="Name of the tenant the admin user belongs to")
- domain = models.CharField(max_length=200, null=True, blank=True, help_text="Name of the domain this controller belongs to")
+ name = StrippedCharField(max_length=200, unique=True, help_text="Name of the Controller")
+ backend_type = StrippedCharField(max_length=200, help_text="Type of compute controller, e.g. EC2, OpenStack, or OpenStack version")
+ version = StrippedCharField(max_length=200, help_text="Controller version")
+ auth_url = StrippedCharField(max_length=200, null=True, blank=True, help_text="Auth url for the compute controller")
+ admin_user = StrippedCharField(max_length=200, null=True, blank=True, help_text="Username of an admin user at this controller")
+ admin_password = StrippedCharField(max_length=200, null=True, blank=True, help_text="Password of theadmin user at this controller")
+ admin_tenant = StrippedCharField(max_length=200, null=True, blank=True, help_text="Name of the tenant the admin user belongs to")
+ domain = StrippedCharField(max_length=200, null=True, blank=True, help_text="Name of the domain this controller belongs to")
deployment = models.ForeignKey(Deployment,related_name='controllerdeployments')
@@ -274,7 +275,7 @@
site = models.ForeignKey(Site,related_name='sitedeployments')
deployment = models.ForeignKey(Deployment,related_name='sitedeployments')
controller = models.ForeignKey(Controller, null=True, blank=True, related_name='sitedeployments')
- availability_zone = models.CharField(max_length=200, null=True, blank=True, help_text="OpenStack availability zone")
+ availability_zone = StrippedCharField(max_length=200, null=True, blank=True, help_text="OpenStack availability zone")
def __unicode__(self): return u'%s %s' % (self.deployment, self.site)
@@ -282,4 +283,4 @@
site = models.ForeignKey(Site,related_name='controllersite')
controller = models.ForeignKey(Controller, null=True, blank=True, related_name='controllersite')
- tenant_id = models.CharField(null=True, blank=True, max_length=200, db_index=True, help_text="Keystone tenant id")
+ tenant_id = StrippedCharField(null=True, blank=True, max_length=200, db_index=True, help_text="Keystone tenant id")
diff --git a/xos/core/models/slice.py b/xos/core/models/slice.py
index d695295..7c4e82f 100644
--- a/xos/core/models/slice.py
+++ b/xos/core/models/slice.py
@@ -13,12 +13,13 @@
from core.models import Service
from core.models import Controller
from core.models import Flavor, Image
+from core.models.plcorebase import StrippedCharField
from django.core.exceptions import PermissionDenied, ValidationError
# Create your models here.
class Slice(PlCoreBase):
- name = models.CharField(unique=True, help_text="The Name of the Slice", max_length=80)
+ name = StrippedCharField(unique=True, help_text="The Name of the Slice", max_length=80)
enabled = models.BooleanField(default=True, help_text="Status for this Slice")
omf_friendly = models.BooleanField(default=False)
description=models.TextField(blank=True,help_text="High level description of the slice and expected activities", max_length=1024)
@@ -26,7 +27,7 @@
site = models.ForeignKey(Site, related_name='slices', help_text="The Site this Slice belongs to")
max_slivers = models.IntegerField(default=10)
service = models.ForeignKey(Service, related_name='service', null=True, blank=True)
- network = models.CharField(default="Private Only",null=True, blank=True, max_length=256)
+ network = StrippedCharField(default="Private Only",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)
@@ -34,7 +35,7 @@
# for tenant view
default_flavor = models.ForeignKey(Flavor, related_name = "slices", null=True, blank=True)
default_image = models.ForeignKey(Image, related_name = "slices", null=True, blank=True);
- mount_data_sets = models.CharField(default="GenBank",null=True, blank=True, max_length=256)
+ mount_data_sets = StrippedCharField(default="GenBank",null=True, blank=True, max_length=256)
def __unicode__(self): return u'%s' % (self.name)
@@ -116,7 +117,7 @@
class SliceRole(PlCoreBase):
ROLE_CHOICES = (('admin','Admin'),('default','Default'))
- role = models.CharField(choices=ROLE_CHOICES, unique=True, max_length=30)
+ role = StrippedCharField(choices=ROLE_CHOICES, unique=True, max_length=30)
def __unicode__(self): return u'%s' % (self.role)
@@ -145,7 +146,7 @@
controller = models.ForeignKey(Controller, related_name='controllerslices')
slice = models.ForeignKey(Slice, related_name='controllerslices')
- tenant_id = models.CharField(null=True, blank=True, max_length=200, help_text="Keystone tenant id")
+ tenant_id = StrippedCharField(null=True, blank=True, max_length=200, help_text="Keystone tenant id")
def __unicode__(self): return u'%s %s' % (self.slice, self.controller)
diff --git a/xos/core/models/slicetag.py b/xos/core/models/slicetag.py
index 246e6fd..7376c88 100644
--- a/xos/core/models/slicetag.py
+++ b/xos/core/models/slicetag.py
@@ -2,13 +2,14 @@
from django.db import models
from core.models import PlCoreBase
from core.models import Slice
+from core.models.plcorebase import StrippedCharField
class SliceTag(PlCoreBase):
slice = models.ForeignKey(Slice, related_name='slicetags')
NAME_CHOICES = (('privatekey', 'Private Key'), ('publickey', 'Public Key'))
- name = models.CharField(help_text="The name of this tag", max_length=30, choices=NAME_CHOICES)
- value = models.CharField(help_text="The value of this tag", max_length=1024)
+ name = StrippedCharField(help_text="The name of this tag", max_length=30, choices=NAME_CHOICES)
+ value = StrippedCharField(help_text="The value of this tag", max_length=1024)
def can_update(self, user):
return user.can_update_slice(self.slice)
diff --git a/xos/core/models/sliver.py b/xos/core/models/sliver.py
index 0173887..1a421b0 100644
--- a/xos/core/models/sliver.py
+++ b/xos/core/models/sliver.py
@@ -3,6 +3,7 @@
from django.db.models import Q
from django.core import exceptions
from core.models import PlCoreBase,PlCoreBaseManager,PlCoreBaseDeletionManager
+from core.models.plcorebase import StrippedCharField
from core.models import Image
from core.models import Slice
from core.models import Node
@@ -80,10 +81,10 @@
class Sliver(PlCoreBase):
objects = SliverManager()
deleted_objects = SliverDeletionManager()
- instance_id = models.CharField(null=True, blank=True, max_length=200, help_text="Nova instance id")
- instance_uuid = models.CharField(null=True, blank=True, max_length=200, help_text="Nova instance uuid")
- name = models.CharField(max_length=200, help_text="Sliver name")
- instance_name = models.CharField(blank=True, null=True, max_length=200, help_text="OpenStack generated name")
+ instance_id = StrippedCharField(null=True, blank=True, max_length=200, help_text="Nova instance id")
+ instance_uuid = StrippedCharField(null=True, blank=True, max_length=200, help_text="Nova instance uuid")
+ name = StrippedCharField(max_length=200, help_text="Sliver name")
+ instance_name = StrippedCharField(blank=True, null=True, max_length=200, help_text="OpenStack generated name")
ip = models.GenericIPAddressField(help_text="Sliver ip address", blank=True, null=True)
image = models.ForeignKey(Image, related_name='slivers')
#key = models.ForeignKey(Key, related_name='slivers')
diff --git a/xos/core/models/tag.py b/xos/core/models/tag.py
index b1e510a..d774800 100644
--- a/xos/core/models/tag.py
+++ b/xos/core/models/tag.py
@@ -2,6 +2,7 @@
from django.db import models
from core.models import PlCoreBase
from core.models import Service
+from core.models.plcorebase import StrippedCharField
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
@@ -12,7 +13,7 @@
service = models.ForeignKey(Service, related_name='tags', help_text="The Service this Tag is associated with")
name = models.SlugField(help_text="The name of this tag", max_length=128)
- value = models.CharField(help_text="The value of this tag", max_length=1024)
+ value = StrippedCharField(help_text="The value of this tag", max_length=1024)
# The required fields to do a ObjectType lookup, and object_id assignment
content_type = models.ForeignKey(ContentType)
diff --git a/xos/core/models/user.py b/xos/core/models/user.py
index cce2dcd..5436a90 100644
--- a/xos/core/models/user.py
+++ b/xos/core/models/user.py
@@ -7,14 +7,15 @@
from django.db import models
from django.db.models import F, Q
from django.utils import timezone
-from core.models import PlCoreBase,Site, DashboardView, PlModelMixIn
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
+from django.core.mail import EmailMultiAlternatives
+from django.core.exceptions import PermissionDenied
+from core.models import PlCoreBase,Site, DashboardView, PlModelMixIn
+from core.models.plcorebase import StrippedCharField
from timezones.fields import TimeZoneField
from operator import itemgetter, attrgetter
-from django.core.mail import EmailMultiAlternatives
from core.middleware import get_request
import model_policy
-from django.core.exceptions import PermissionDenied
# ------ from plcorebase.py ------
try:
@@ -99,12 +100,12 @@
db_index=True,
)
- username = models.CharField(max_length=255, default="Something" )
+ username = StrippedCharField(max_length=255, default="Something" )
- firstname = models.CharField(help_text="person's given name", max_length=200)
- lastname = models.CharField(help_text="person's surname", max_length=200)
+ firstname = StrippedCharField(help_text="person's given name", max_length=200)
+ lastname = StrippedCharField(help_text="person's surname", max_length=200)
- phone = models.CharField(null=True, blank=True, help_text="phone number contact", max_length=100)
+ phone = StrippedCharField(null=True, blank=True, help_text="phone number contact", max_length=100)
user_url = models.URLField(null=True, blank=True)
site = models.ForeignKey(Site, related_name='users', help_text="Site this user will be homed too", null=True)
public_key = models.TextField(null=True, blank=True, max_length=1024, help_text="Public key string")
@@ -119,7 +120,7 @@
updated = models.DateTimeField(auto_now=True)
enacted = models.DateTimeField(null=True, default=None)
policed = models.DateTimeField(null=True, default=None)
- backend_status = models.CharField(max_length=1024,
+ backend_status = StrippedCharField(max_length=1024,
default="Provisioning in progress")
deleted = models.BooleanField(default=False)