expose plcorebase.validators to REST API
diff --git a/planetstack/apigen/api.template.py b/planetstack/apigen/api.template.py
index 710f051..b17f135 100644
--- a/planetstack/apigen/api.template.py
+++ b/planetstack/apigen/api.template.py
@@ -30,7 +30,6 @@
{% for object in generator.all %}
url(r'plstackapi/{{ object.rest_name }}/$', {{ object.camel }}List.as_view(), name='{{ object.singular }}-list'),
url(r'plstackapi/{{ object.rest_name }}/(?P<pk>[a-zA-Z0-9\-]+)/$', {{ object.camel }}Detail.as_view(), name ='{{ object.singular }}-detail'),
-# url(r'plstackapi/{{ object.rest_name }}/!new/$', {{ object.camel }}New.as_view(), name ='{{ object.singular }}-new'),
{% endfor %}
)
@@ -55,11 +54,17 @@
{% endif %}
{% endfor %}
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = {{ object.camel }}
- fields = ('humanReadableName', {% for prop in object.props %}'{{ prop }}',{% endfor %}{% for ref in object.refs %}{%if ref.multi %}'{{ ref.plural }}'{% else %}'{{ ref }}'{% endif %},{% endfor %})
+ fields = ('humanReadableName', 'validators', {% for prop in object.props %}'{{ prop }}',{% endfor %}{% for ref in object.refs %}{%if ref.multi %}'{{ ref.plural }}'{% else %}'{{ ref }}'{% endif %},{% endfor %})
class {{ object.camel }}IdSerializer(serializers.ModelSerializer):
id = serializers.Field()
@@ -71,11 +76,17 @@
{% endif %}
{% endfor %}
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = {{ object.camel }}
- fields = ('humanReadableName', {% for prop in object.props %}'{{ prop }}',{% endfor %}{% for ref in object.refs %}{%if ref.multi %}'{{ ref.plural }}'{% else %}'{{ ref }}'{% endif %},{% endfor %})
+ fields = ('humanReadableName', 'validators', {% for prop in object.props %}'{{ prop }}',{% endfor %}{% for ref in object.refs %}{%if ref.multi %}'{{ ref.plural }}'{% else %}'{{ ref }}'{% endif %},{% endfor %})
{% endfor %}
@@ -100,16 +111,20 @@
files=request.FILES, partial=partial)
if not serializer.is_valid():
- print "UpdateModelMixin: not serializer.is_valid"
- print serializer.errors
- return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
try:
self.pre_save(serializer.object)
except ValidationError as err:
# full_clean on model instance may be called in pre_save,
# so we have to handle eventual errors.
- return Response(err.message_dict, status=status.HTTP_400_BAD_REQUEST)
+ response = {"error": "validation",
+ "specific_error": "ValidationError in pre_save",
+ "reasons": err.message_dict}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
if serializer.object is not None:
if not serializer.object.can_update(request.user):
@@ -155,7 +170,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -189,29 +207,4 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class {{ object.camel }}New(GenericAPIView):
- serializer_class = {{ object.camel }}Serializer
- id_serializer_class = {{ object.camel }}IdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = {{ object.camel }}()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
{% endfor %}
diff --git a/planetstack/genapi.py b/planetstack/genapi.py
index 5fba0c4..2510db9 100644
--- a/planetstack/genapi.py
+++ b/planetstack/genapi.py
@@ -30,199 +30,150 @@
url(r'plstackapi/serviceattributes/$', ServiceAttributeList.as_view(), name='serviceattribute-list'),
url(r'plstackapi/serviceattributes/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceAttributeDetail.as_view(), name ='serviceattribute-detail'),
-# url(r'plstackapi/serviceattributes/!new/$', ServiceAttributeNew.as_view(), name ='serviceattribute-new'),
url(r'plstackapi/images/$', ImageList.as_view(), name='image-list'),
url(r'plstackapi/images/(?P<pk>[a-zA-Z0-9\-]+)/$', ImageDetail.as_view(), name ='image-detail'),
-# url(r'plstackapi/images/!new/$', ImageNew.as_view(), name ='image-new'),
url(r'plstackapi/networkparameters/$', NetworkParameterList.as_view(), name='networkparameter-list'),
url(r'plstackapi/networkparameters/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkParameterDetail.as_view(), name ='networkparameter-detail'),
-# url(r'plstackapi/networkparameters/!new/$', NetworkParameterNew.as_view(), name ='networkparameter-new'),
url(r'plstackapi/sites/$', SiteList.as_view(), name='site-list'),
url(r'plstackapi/sites/(?P<pk>[a-zA-Z0-9\-]+)/$', SiteDetail.as_view(), name ='site-detail'),
-# url(r'plstackapi/sites/!new/$', SiteNew.as_view(), name ='site-new'),
url(r'plstackapi/slice_roles/$', SliceRoleList.as_view(), name='slicerole-list'),
url(r'plstackapi/slice_roles/(?P<pk>[a-zA-Z0-9\-]+)/$', SliceRoleDetail.as_view(), name ='slicerole-detail'),
-# url(r'plstackapi/slice_roles/!new/$', SliceRoleNew.as_view(), name ='slicerole-new'),
url(r'plstackapi/tags/$', TagList.as_view(), name='tag-list'),
url(r'plstackapi/tags/(?P<pk>[a-zA-Z0-9\-]+)/$', TagDetail.as_view(), name ='tag-detail'),
-# url(r'plstackapi/tags/!new/$', TagNew.as_view(), name ='tag-new'),
url(r'plstackapi/invoices/$', InvoiceList.as_view(), name='invoice-list'),
url(r'plstackapi/invoices/(?P<pk>[a-zA-Z0-9\-]+)/$', InvoiceDetail.as_view(), name ='invoice-detail'),
-# url(r'plstackapi/invoices/!new/$', InvoiceNew.as_view(), name ='invoice-new'),
url(r'plstackapi/slice_privileges/$', SlicePrivilegeList.as_view(), name='sliceprivilege-list'),
url(r'plstackapi/slice_privileges/(?P<pk>[a-zA-Z0-9\-]+)/$', SlicePrivilegeDetail.as_view(), name ='sliceprivilege-detail'),
-# url(r'plstackapi/slice_privileges/!new/$', SlicePrivilegeNew.as_view(), name ='sliceprivilege-new'),
url(r'plstackapi/planetstackroles/$', PlanetStackRoleList.as_view(), name='planetstackrole-list'),
url(r'plstackapi/planetstackroles/(?P<pk>[a-zA-Z0-9\-]+)/$', PlanetStackRoleDetail.as_view(), name ='planetstackrole-detail'),
-# url(r'plstackapi/planetstackroles/!new/$', PlanetStackRoleNew.as_view(), name ='planetstackrole-new'),
url(r'plstackapi/networkslivers/$', NetworkSliverList.as_view(), name='networksliver-list'),
url(r'plstackapi/networkslivers/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkSliverDetail.as_view(), name ='networksliver-detail'),
-# url(r'plstackapi/networkslivers/!new/$', NetworkSliverNew.as_view(), name ='networksliver-new'),
url(r'plstackapi/networkdeployments/$', NetworkDeploymentsList.as_view(), name='networkdeployments-list'),
url(r'plstackapi/networkdeployments/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkDeploymentsDetail.as_view(), name ='networkdeployments-detail'),
-# url(r'plstackapi/networkdeployments/!new/$', NetworkDeploymentsNew.as_view(), name ='networkdeployments-new'),
url(r'plstackapi/flavors/$', FlavorList.as_view(), name='flavor-list'),
url(r'plstackapi/flavors/(?P<pk>[a-zA-Z0-9\-]+)/$', FlavorDetail.as_view(), name ='flavor-detail'),
-# url(r'plstackapi/flavors/!new/$', FlavorNew.as_view(), name ='flavor-new'),
url(r'plstackapi/projects/$', ProjectList.as_view(), name='project-list'),
url(r'plstackapi/projects/(?P<pk>[a-zA-Z0-9\-]+)/$', ProjectDetail.as_view(), name ='project-detail'),
-# url(r'plstackapi/projects/!new/$', ProjectNew.as_view(), name ='project-new'),
url(r'plstackapi/slices/$', SliceList.as_view(), name='slice-list'),
url(r'plstackapi/slices/(?P<pk>[a-zA-Z0-9\-]+)/$', SliceDetail.as_view(), name ='slice-detail'),
-# url(r'plstackapi/slices/!new/$', SliceNew.as_view(), name ='slice-new'),
url(r'plstackapi/networks/$', NetworkList.as_view(), name='network-list'),
url(r'plstackapi/networks/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkDetail.as_view(), name ='network-detail'),
-# url(r'plstackapi/networks/!new/$', NetworkNew.as_view(), name ='network-new'),
url(r'plstackapi/services/$', ServiceList.as_view(), name='service-list'),
url(r'plstackapi/services/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceDetail.as_view(), name ='service-detail'),
-# url(r'plstackapi/services/!new/$', ServiceNew.as_view(), name ='service-new'),
url(r'plstackapi/serviceclasses/$', ServiceClassList.as_view(), name='serviceclass-list'),
url(r'plstackapi/serviceclasses/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceClassDetail.as_view(), name ='serviceclass-detail'),
-# url(r'plstackapi/serviceclasses/!new/$', ServiceClassNew.as_view(), name ='serviceclass-new'),
url(r'plstackapi/payments/$', PaymentList.as_view(), name='payment-list'),
url(r'plstackapi/payments/(?P<pk>[a-zA-Z0-9\-]+)/$', PaymentDetail.as_view(), name ='payment-detail'),
-# url(r'plstackapi/payments/!new/$', PaymentNew.as_view(), name ='payment-new'),
url(r'plstackapi/charges/$', ChargeList.as_view(), name='charge-list'),
url(r'plstackapi/charges/(?P<pk>[a-zA-Z0-9\-]+)/$', ChargeDetail.as_view(), name ='charge-detail'),
-# url(r'plstackapi/charges/!new/$', ChargeNew.as_view(), name ='charge-new'),
url(r'plstackapi/roles/$', RoleList.as_view(), name='role-list'),
url(r'plstackapi/roles/(?P<pk>[a-zA-Z0-9\-]+)/$', RoleDetail.as_view(), name ='role-detail'),
-# url(r'plstackapi/roles/!new/$', RoleNew.as_view(), name ='role-new'),
url(r'plstackapi/usableobjects/$', UsableObjectList.as_view(), name='usableobject-list'),
url(r'plstackapi/usableobjects/(?P<pk>[a-zA-Z0-9\-]+)/$', UsableObjectDetail.as_view(), name ='usableobject-detail'),
-# url(r'plstackapi/usableobjects/!new/$', UsableObjectNew.as_view(), name ='usableobject-new'),
url(r'plstackapi/site_roles/$', SiteRoleList.as_view(), name='siterole-list'),
url(r'plstackapi/site_roles/(?P<pk>[a-zA-Z0-9\-]+)/$', SiteRoleDetail.as_view(), name ='siterole-detail'),
-# url(r'plstackapi/site_roles/!new/$', SiteRoleNew.as_view(), name ='siterole-new'),
url(r'plstackapi/slicecredentials/$', SliceCredentialList.as_view(), name='slicecredential-list'),
url(r'plstackapi/slicecredentials/(?P<pk>[a-zA-Z0-9\-]+)/$', SliceCredentialDetail.as_view(), name ='slicecredential-detail'),
-# url(r'plstackapi/slicecredentials/!new/$', SliceCredentialNew.as_view(), name ='slicecredential-new'),
url(r'plstackapi/slivers/$', SliverList.as_view(), name='sliver-list'),
url(r'plstackapi/slivers/(?P<pk>[a-zA-Z0-9\-]+)/$', SliverDetail.as_view(), name ='sliver-detail'),
-# url(r'plstackapi/slivers/!new/$', SliverNew.as_view(), name ='sliver-new'),
url(r'plstackapi/nodes/$', NodeList.as_view(), name='node-list'),
url(r'plstackapi/nodes/(?P<pk>[a-zA-Z0-9\-]+)/$', NodeDetail.as_view(), name ='node-detail'),
-# url(r'plstackapi/nodes/!new/$', NodeNew.as_view(), name ='node-new'),
url(r'plstackapi/dashboardviews/$', DashboardViewList.as_view(), name='dashboardview-list'),
url(r'plstackapi/dashboardviews/(?P<pk>[a-zA-Z0-9\-]+)/$', DashboardViewDetail.as_view(), name ='dashboardview-detail'),
-# url(r'plstackapi/dashboardviews/!new/$', DashboardViewNew.as_view(), name ='dashboardview-new'),
url(r'plstackapi/imagedeployments/$', ImageDeploymentsList.as_view(), name='imagedeployments-list'),
url(r'plstackapi/imagedeployments/(?P<pk>[a-zA-Z0-9\-]+)/$', ImageDeploymentsDetail.as_view(), name ='imagedeployments-detail'),
-# url(r'plstackapi/imagedeployments/!new/$', ImageDeploymentsNew.as_view(), name ='imagedeployments-new'),
url(r'plstackapi/reservedresources/$', ReservedResourceList.as_view(), name='reservedresource-list'),
url(r'plstackapi/reservedresources/(?P<pk>[a-zA-Z0-9\-]+)/$', ReservedResourceDetail.as_view(), name ='reservedresource-detail'),
-# url(r'plstackapi/reservedresources/!new/$', ReservedResourceNew.as_view(), name ='reservedresource-new'),
url(r'plstackapi/networkslices/$', NetworkSliceList.as_view(), name='networkslice-list'),
url(r'plstackapi/networkslices/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkSliceDetail.as_view(), name ='networkslice-detail'),
-# url(r'plstackapi/networkslices/!new/$', NetworkSliceNew.as_view(), name ='networkslice-new'),
url(r'plstackapi/userdashboardviews/$', UserDashboardViewList.as_view(), name='userdashboardview-list'),
url(r'plstackapi/userdashboardviews/(?P<pk>[a-zA-Z0-9\-]+)/$', UserDashboardViewDetail.as_view(), name ='userdashboardview-detail'),
-# url(r'plstackapi/userdashboardviews/!new/$', UserDashboardViewNew.as_view(), name ='userdashboardview-new'),
url(r'plstackapi/planetstackprivileges/$', PlanetStackPrivilegeList.as_view(), name='planetstackprivilege-list'),
url(r'plstackapi/planetstackprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', PlanetStackPrivilegeDetail.as_view(), name ='planetstackprivilege-detail'),
-# url(r'plstackapi/planetstackprivileges/!new/$', PlanetStackPrivilegeNew.as_view(), name ='planetstackprivilege-new'),
url(r'plstackapi/users/$', UserList.as_view(), name='user-list'),
url(r'plstackapi/users/(?P<pk>[a-zA-Z0-9\-]+)/$', UserDetail.as_view(), name ='user-detail'),
-# url(r'plstackapi/users/!new/$', UserNew.as_view(), name ='user-new'),
url(r'plstackapi/deployments/$', DeploymentList.as_view(), name='deployment-list'),
url(r'plstackapi/deployments/(?P<pk>[a-zA-Z0-9\-]+)/$', DeploymentDetail.as_view(), name ='deployment-detail'),
-# url(r'plstackapi/deployments/!new/$', DeploymentNew.as_view(), name ='deployment-new'),
url(r'plstackapi/reservations/$', ReservationList.as_view(), name='reservation-list'),
url(r'plstackapi/reservations/(?P<pk>[a-zA-Z0-9\-]+)/$', ReservationDetail.as_view(), name ='reservation-detail'),
-# url(r'plstackapi/reservations/!new/$', ReservationNew.as_view(), name ='reservation-new'),
url(r'plstackapi/slicedeployments/$', SliceDeploymentsList.as_view(), name='slicedeployments-list'),
url(r'plstackapi/slicedeployments/(?P<pk>[a-zA-Z0-9\-]+)/$', SliceDeploymentsDetail.as_view(), name ='slicedeployments-detail'),
-# url(r'plstackapi/slicedeployments/!new/$', SliceDeploymentsNew.as_view(), name ='slicedeployments-new'),
url(r'plstackapi/siteprivileges/$', SitePrivilegeList.as_view(), name='siteprivilege-list'),
url(r'plstackapi/siteprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', SitePrivilegeDetail.as_view(), name ='siteprivilege-detail'),
-# url(r'plstackapi/siteprivileges/!new/$', SitePrivilegeNew.as_view(), name ='siteprivilege-new'),
url(r'plstackapi/planetstacks/$', PlanetStackList.as_view(), name='planetstack-list'),
url(r'plstackapi/planetstacks/(?P<pk>[a-zA-Z0-9\-]+)/$', PlanetStackDetail.as_view(), name ='planetstack-detail'),
-# url(r'plstackapi/planetstacks/!new/$', PlanetStackNew.as_view(), name ='planetstack-new'),
url(r'plstackapi/userdeployments/$', UserDeploymentsList.as_view(), name='userdeployments-list'),
url(r'plstackapi/userdeployments/(?P<pk>[a-zA-Z0-9\-]+)/$', UserDeploymentsDetail.as_view(), name ='userdeployments-detail'),
-# url(r'plstackapi/userdeployments/!new/$', UserDeploymentsNew.as_view(), name ='userdeployments-new'),
url(r'plstackapi/accounts/$', AccountList.as_view(), name='account-list'),
url(r'plstackapi/accounts/(?P<pk>[a-zA-Z0-9\-]+)/$', AccountDetail.as_view(), name ='account-detail'),
-# url(r'plstackapi/accounts/!new/$', AccountNew.as_view(), name ='account-new'),
url(r'plstackapi/networkparametertypes/$', NetworkParameterTypeList.as_view(), name='networkparametertype-list'),
url(r'plstackapi/networkparametertypes/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkParameterTypeDetail.as_view(), name ='networkparametertype-detail'),
-# url(r'plstackapi/networkparametertypes/!new/$', NetworkParameterTypeNew.as_view(), name ='networkparametertype-new'),
url(r'plstackapi/sitecredentials/$', SiteCredentialList.as_view(), name='sitecredential-list'),
url(r'plstackapi/sitecredentials/(?P<pk>[a-zA-Z0-9\-]+)/$', SiteCredentialDetail.as_view(), name ='sitecredential-detail'),
-# url(r'plstackapi/sitecredentials/!new/$', SiteCredentialNew.as_view(), name ='sitecredential-new'),
url(r'plstackapi/deploymentprivileges/$', DeploymentPrivilegeList.as_view(), name='deploymentprivilege-list'),
url(r'plstackapi/deploymentprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', DeploymentPrivilegeDetail.as_view(), name ='deploymentprivilege-detail'),
-# url(r'plstackapi/deploymentprivileges/!new/$', DeploymentPrivilegeNew.as_view(), name ='deploymentprivilege-new'),
url(r'plstackapi/deploymentroles/$', DeploymentRoleList.as_view(), name='deploymentrole-list'),
url(r'plstackapi/deploymentroles/(?P<pk>[a-zA-Z0-9\-]+)/$', DeploymentRoleDetail.as_view(), name ='deploymentrole-detail'),
-# url(r'plstackapi/deploymentroles/!new/$', DeploymentRoleNew.as_view(), name ='deploymentrole-new'),
url(r'plstackapi/usercredentials/$', UserCredentialList.as_view(), name='usercredential-list'),
url(r'plstackapi/usercredentials/(?P<pk>[a-zA-Z0-9\-]+)/$', UserCredentialDetail.as_view(), name ='usercredential-detail'),
-# url(r'plstackapi/usercredentials/!new/$', UserCredentialNew.as_view(), name ='usercredential-new'),
url(r'plstackapi/sitedeployments/$', SiteDeploymentsList.as_view(), name='sitedeployments-list'),
url(r'plstackapi/sitedeployments/(?P<pk>[a-zA-Z0-9\-]+)/$', SiteDeploymentsDetail.as_view(), name ='sitedeployments-detail'),
-# url(r'plstackapi/sitedeployments/!new/$', SiteDeploymentsNew.as_view(), name ='sitedeployments-new'),
url(r'plstackapi/slicetags/$', SliceTagList.as_view(), name='slicetag-list'),
url(r'plstackapi/slicetags/(?P<pk>[a-zA-Z0-9\-]+)/$', SliceTagDetail.as_view(), name ='slicetag-detail'),
-# url(r'plstackapi/slicetags/!new/$', SliceTagNew.as_view(), name ='slicetag-new'),
url(r'plstackapi/networktemplates/$', NetworkTemplateList.as_view(), name='networktemplate-list'),
url(r'plstackapi/networktemplates/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkTemplateDetail.as_view(), name ='networktemplate-detail'),
-# url(r'plstackapi/networktemplates/!new/$', NetworkTemplateNew.as_view(), name ='networktemplate-new'),
url(r'plstackapi/routers/$', RouterList.as_view(), name='router-list'),
url(r'plstackapi/routers/(?P<pk>[a-zA-Z0-9\-]+)/$', RouterDetail.as_view(), name ='router-detail'),
-# url(r'plstackapi/routers/!new/$', RouterNew.as_view(), name ='router-new'),
url(r'plstackapi/serviceresources/$', ServiceResourceList.as_view(), name='serviceresource-list'),
url(r'plstackapi/serviceresources/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceResourceDetail.as_view(), name ='serviceresource-detail'),
-# url(r'plstackapi/serviceresources/!new/$', ServiceResourceNew.as_view(), name ='serviceresource-new'),
)
@@ -289,21 +240,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = ServiceAttribute
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','value','service',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','value','service',)
class ServiceAttributeIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = ServiceAttribute
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','value','service',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','value','service',)
@@ -312,21 +275,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Image
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','disk_format','container_format','path',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','disk_format','container_format','path',)
class ImageIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Image
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','disk_format','container_format','path',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','disk_format','container_format','path',)
@@ -335,21 +310,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = NetworkParameter
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','parameter','value','content_type','object_id',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','parameter','value','content_type','object_id',)
class NetworkParameterIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = NetworkParameter
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','parameter','value','content_type','object_id',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','parameter','value','content_type','object_id',)
@@ -358,21 +345,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Site
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','site_url','enabled','location','longitude','latitude','login_base','is_public','abbreviated_name',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','site_url','enabled','location','longitude','latitude','login_base','is_public','abbreviated_name',)
class SiteIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Site
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','site_url','enabled','location','longitude','latitude','login_base','is_public','abbreviated_name',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','site_url','enabled','location','longitude','latitude','login_base','is_public','abbreviated_name',)
@@ -381,21 +380,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = SliceRole
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','role',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','role',)
class SliceRoleIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = SliceRole
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','role',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','role',)
@@ -404,21 +415,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Tag
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','service','name','value','content_type','object_id',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','service','name','value','content_type','object_id',)
class TagIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Tag
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','service','name','value','content_type','object_id',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','service','name','value','content_type','object_id',)
@@ -427,21 +450,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Invoice
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','date','account',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','date','account',)
class InvoiceIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Invoice
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','date','account',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','date','account',)
@@ -450,21 +485,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = SlicePrivilege
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','user','slice','role',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','slice','role',)
class SlicePrivilegeIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = SlicePrivilege
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','user','slice','role',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','slice','role',)
@@ -473,21 +520,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = PlanetStackRole
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','role',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','role',)
class PlanetStackRoleIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = PlanetStackRole
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','role',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','role',)
@@ -496,21 +555,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = NetworkSliver
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','network','sliver','ip','port_id',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','network','sliver','ip','port_id',)
class NetworkSliverIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = NetworkSliver
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','network','sliver','ip','port_id',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','network','sliver','ip','port_id',)
@@ -519,21 +590,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = NetworkDeployments
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','network','deployment','net_id','router_id','subnet_id','subnet',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','network','deployment','net_id','router_id','subnet_id','subnet',)
class NetworkDeploymentsIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = NetworkDeployments
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','network','deployment','net_id','router_id','subnet_id','subnet',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','network','deployment','net_id','router_id','subnet_id','subnet',)
@@ -542,21 +625,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Flavor
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','description','flavor','order','default',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','description','flavor','order','default',)
class FlavorIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Flavor
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','description','flavor','order','default',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','description','flavor','order','default',)
@@ -565,21 +660,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Project
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name',)
class ProjectIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Project
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name',)
@@ -604,11 +711,17 @@
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Slice
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','enabled','omf_friendly','description','slice_url','site','max_slivers','imagePreference','service','network','mountDataSets','serviceClass','creator','networks','availableNetworks','networks','networks',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','enabled','omf_friendly','description','slice_url','site','max_slivers','imagePreference','service','network','mountDataSets','serviceClass','creator','networks','availableNetworks','networks','networks',)
class SliceIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
@@ -630,11 +743,17 @@
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Slice
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','enabled','omf_friendly','description','slice_url','site','max_slivers','imagePreference','service','network','mountDataSets','serviceClass','creator','networks','availableNetworks','networks','networks',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','enabled','omf_friendly','description','slice_url','site','max_slivers','imagePreference','service','network','mountDataSets','serviceClass','creator','networks','availableNetworks','networks','networks',)
@@ -659,11 +778,17 @@
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Network
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','template','subnet','ports','labels','owner','guaranteedBandwidth','permitAllSlices','topologyParameters','controllerUrl','controllerParameters','network_id','router_id','subnet_id','routers','availableRouters','routers','routers',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','template','subnet','ports','labels','owner','guaranteedBandwidth','permitAllSlices','topologyParameters','controllerUrl','controllerParameters','network_id','router_id','subnet_id','routers','availableRouters','routers','routers',)
class NetworkIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
@@ -685,11 +810,17 @@
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Network
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','template','subnet','ports','labels','owner','guaranteedBandwidth','permitAllSlices','topologyParameters','controllerUrl','controllerParameters','network_id','router_id','subnet_id','routers','availableRouters','routers','routers',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','template','subnet','ports','labels','owner','guaranteedBandwidth','permitAllSlices','topologyParameters','controllerUrl','controllerParameters','network_id','router_id','subnet_id','routers','availableRouters','routers','routers',)
@@ -698,21 +829,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Service
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','description','enabled','name','versionNumber','published',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','description','enabled','name','versionNumber','published',)
class ServiceIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Service
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','description','enabled','name','versionNumber','published',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','description','enabled','name','versionNumber','published',)
@@ -721,21 +864,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = ServiceClass
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','description','commitment','membershipFee','membershipFeeMonths','upgradeRequiresApproval',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','description','commitment','membershipFee','membershipFeeMonths','upgradeRequiresApproval',)
class ServiceClassIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = ServiceClass
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','description','commitment','membershipFee','membershipFeeMonths','upgradeRequiresApproval',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','description','commitment','membershipFee','membershipFeeMonths','upgradeRequiresApproval',)
@@ -744,21 +899,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Payment
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','account','amount','date',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','account','amount','date',)
class PaymentIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Payment
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','account','amount','date',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','account','amount','date',)
@@ -767,21 +934,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Charge
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','account','slice','kind','state','date','object','amount','coreHours','invoice',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','account','slice','kind','state','date','object','amount','coreHours','invoice',)
class ChargeIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Charge
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','account','slice','kind','state','date','object','amount','coreHours','invoice',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','account','slice','kind','state','date','object','amount','coreHours','invoice',)
@@ -790,21 +969,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Role
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','role_type','role','description','content_type',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','role_type','role','description','content_type',)
class RoleIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Role
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','role_type','role','description','content_type',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','role_type','role','description','content_type',)
@@ -813,21 +1004,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = UsableObject
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name',)
class UsableObjectIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = UsableObject
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name',)
@@ -836,21 +1039,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = SiteRole
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','role',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','role',)
class SiteRoleIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = SiteRole
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','role',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','role',)
@@ -859,21 +1074,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = SliceCredential
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','slice','name','key_id','enc_value',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','slice','name','key_id','enc_value',)
class SliceCredentialIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = SliceCredential
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','slice','name','key_id','enc_value',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','slice','name','key_id','enc_value',)
@@ -890,11 +1117,17 @@
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Sliver
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','instance_id','name','instance_name','ip','image','creator','slice','node','deploymentNetwork','numberCores','flavor','userData','networks','networks',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','instance_id','name','instance_name','ip','image','creator','slice','node','deploymentNetwork','numberCores','flavor','userData','networks','networks',)
class SliverIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
@@ -908,11 +1141,17 @@
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Sliver
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','instance_id','name','instance_name','ip','image','creator','slice','node','deploymentNetwork','numberCores','flavor','userData','networks','networks',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','instance_id','name','instance_name','ip','image','creator','slice','node','deploymentNetwork','numberCores','flavor','userData','networks','networks',)
@@ -921,21 +1160,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Node
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','site','deployment',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','site','deployment',)
class NodeIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Node
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','site','deployment',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','site','deployment',)
@@ -944,21 +1195,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = DashboardView
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','url',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','url',)
class DashboardViewIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = DashboardView
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','url',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','url',)
@@ -967,21 +1230,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = ImageDeployments
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','image','deployment','glance_image_id',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','image','deployment','glance_image_id',)
class ImageDeploymentsIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = ImageDeployments
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','image','deployment','glance_image_id',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','image','deployment','glance_image_id',)
@@ -990,21 +1265,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = ReservedResource
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','sliver','resource','quantity','reservationSet',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','sliver','resource','quantity','reservationSet',)
class ReservedResourceIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = ReservedResource
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','sliver','resource','quantity','reservationSet',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','sliver','resource','quantity','reservationSet',)
@@ -1013,21 +1300,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = NetworkSlice
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','network','slice',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','network','slice',)
class NetworkSliceIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = NetworkSlice
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','network','slice',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','network','slice',)
@@ -1036,21 +1335,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = UserDashboardView
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','user','dashboardView','order',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','dashboardView','order',)
class UserDashboardViewIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = UserDashboardView
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','user','dashboardView','order',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','dashboardView','order',)
@@ -1059,21 +1370,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = PlanetStackPrivilege
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','user','planetstack','role',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','planetstack','role',)
class PlanetStackPrivilegeIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = PlanetStackPrivilege
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','user','planetstack','role',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','planetstack','role',)
@@ -1082,21 +1405,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = User
- fields = ('humanReadableName', 'id','password','last_login','email','username','firstname','lastname','phone','user_url','site','public_key','is_active','is_admin','is_staff','is_readonly','created','updated','enacted','backend_status','deleted','timezone',)
+ fields = ('humanReadableName', 'validators', 'id','password','last_login','email','username','firstname','lastname','phone','user_url','site','public_key','is_active','is_admin','is_staff','is_readonly','created','updated','enacted','backend_status','deleted','timezone',)
class UserIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = User
- fields = ('humanReadableName', 'id','password','last_login','email','username','firstname','lastname','phone','user_url','site','public_key','is_active','is_admin','is_staff','is_readonly','created','updated','enacted','backend_status','deleted','timezone',)
+ fields = ('humanReadableName', 'validators', 'id','password','last_login','email','username','firstname','lastname','phone','user_url','site','public_key','is_active','is_admin','is_staff','is_readonly','created','updated','enacted','backend_status','deleted','timezone',)
@@ -1121,11 +1456,17 @@
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Deployment
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','admin_user','admin_password','admin_tenant','auth_url','backend_type','availability_zone','accessControl','sites','sites','flavors','flavors',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','admin_user','admin_password','admin_tenant','auth_url','backend_type','availability_zone','accessControl','sites','sites','flavors','flavors',)
class DeploymentIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
@@ -1147,11 +1488,17 @@
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Deployment
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','admin_user','admin_password','admin_tenant','auth_url','backend_type','availability_zone','accessControl','sites','sites','flavors','flavors',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','admin_user','admin_password','admin_tenant','auth_url','backend_type','availability_zone','accessControl','sites','sites','flavors','flavors',)
@@ -1160,21 +1507,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Reservation
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','startTime','slice','duration',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','startTime','slice','duration',)
class ReservationIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Reservation
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','startTime','slice','duration',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','startTime','slice','duration',)
@@ -1183,21 +1542,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = SliceDeployments
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','slice','deployment','tenant_id','network_id','router_id','subnet_id',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','slice','deployment','tenant_id','network_id','router_id','subnet_id',)
class SliceDeploymentsIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = SliceDeployments
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','slice','deployment','tenant_id','network_id','router_id','subnet_id',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','slice','deployment','tenant_id','network_id','router_id','subnet_id',)
@@ -1206,21 +1577,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = SitePrivilege
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','user','site','role',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','site','role',)
class SitePrivilegeIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = SitePrivilege
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','user','site','role',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','site','role',)
@@ -1229,21 +1612,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = PlanetStack
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','description',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','description',)
class PlanetStackIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = PlanetStack
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','description',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','description',)
@@ -1252,21 +1647,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = UserDeployments
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','user','deployment','kuser_id',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','deployment','kuser_id',)
class UserDeploymentsIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = UserDeployments
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','user','deployment','kuser_id',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','deployment','kuser_id',)
@@ -1275,21 +1682,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Account
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','site',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','site',)
class AccountIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Account
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','site',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','site',)
@@ -1298,21 +1717,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = NetworkParameterType
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','description',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','description',)
class NetworkParameterTypeIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = NetworkParameterType
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','description',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','description',)
@@ -1321,21 +1752,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = SiteCredential
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','site','name','key_id','enc_value',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','site','name','key_id','enc_value',)
class SiteCredentialIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = SiteCredential
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','site','name','key_id','enc_value',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','site','name','key_id','enc_value',)
@@ -1344,21 +1787,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = DeploymentPrivilege
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','user','deployment','role',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','deployment','role',)
class DeploymentPrivilegeIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = DeploymentPrivilege
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','user','deployment','role',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','deployment','role',)
@@ -1367,21 +1822,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = DeploymentRole
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','role',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','role',)
class DeploymentRoleIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = DeploymentRole
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','role',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','role',)
@@ -1390,21 +1857,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = UserCredential
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','user','name','key_id','enc_value',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','name','key_id','enc_value',)
class UserCredentialIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = UserCredential
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','user','name','key_id','enc_value',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','user','name','key_id','enc_value',)
@@ -1413,21 +1892,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = SiteDeployments
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','site','deployment','tenant_id',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','site','deployment','tenant_id',)
class SiteDeploymentsIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = SiteDeployments
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','site','deployment','tenant_id',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','site','deployment','tenant_id',)
@@ -1436,21 +1927,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = SliceTag
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','slice','name','value',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','slice','name','value',)
class SliceTagIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = SliceTag
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','slice','name','value',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','slice','name','value',)
@@ -1459,21 +1962,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = NetworkTemplate
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','description','guaranteedBandwidth','visibility','translation','sharedNetworkName','sharedNetworkId','topologyKind','controllerKind',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','description','guaranteedBandwidth','visibility','translation','sharedNetworkName','sharedNetworkId','topologyKind','controllerKind',)
class NetworkTemplateIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = NetworkTemplate
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','description','guaranteedBandwidth','visibility','translation','sharedNetworkName','sharedNetworkId','topologyKind','controllerKind',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','description','guaranteedBandwidth','visibility','translation','sharedNetworkName','sharedNetworkId','topologyKind','controllerKind',)
@@ -1482,21 +1997,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Router
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','owner',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','owner',)
class RouterIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = Router
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','name','owner',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','name','owner',)
@@ -1505,21 +2032,33 @@
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = ServiceResource
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','serviceClass','name','maxUnitsDeployment','maxUnitsNode','maxDuration','bucketInRate','bucketMaxSize','cost','calendarReservable',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','serviceClass','name','maxUnitsDeployment','maxUnitsNode','maxDuration','bucketInRate','bucketMaxSize','cost','calendarReservable',)
class ServiceResourceIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
def getHumanReadableName(self, obj):
return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
class Meta:
model = ServiceResource
- fields = ('humanReadableName', 'id','created','updated','enacted','backend_status','deleted','serviceClass','name','maxUnitsDeployment','maxUnitsNode','maxDuration','bucketInRate','bucketMaxSize','cost','calendarReservable',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','backend_status','deleted','serviceClass','name','maxUnitsDeployment','maxUnitsNode','maxDuration','bucketInRate','bucketMaxSize','cost','calendarReservable',)
@@ -1640,16 +2179,20 @@
files=request.FILES, partial=partial)
if not serializer.is_valid():
- print "UpdateModelMixin: not serializer.is_valid"
- print serializer.errors
- return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
try:
self.pre_save(serializer.object)
except ValidationError as err:
# full_clean on model instance may be called in pre_save,
# so we have to handle eventual errors.
- return Response(err.message_dict, status=status.HTTP_400_BAD_REQUEST)
+ response = {"error": "validation",
+ "specific_error": "ValidationError in pre_save",
+ "reasons": err.message_dict}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
if serializer.object is not None:
if not serializer.object.can_update(request.user):
@@ -1695,7 +2238,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -1729,31 +2275,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class ServiceAttributeNew(GenericAPIView):
- serializer_class = ServiceAttributeSerializer
- id_serializer_class = ServiceAttributeIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = ServiceAttribute()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class ImageList(generics.ListCreateAPIView):
@@ -1776,7 +2297,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -1810,31 +2334,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class ImageNew(GenericAPIView):
- serializer_class = ImageSerializer
- id_serializer_class = ImageIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = Image()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class NetworkParameterList(generics.ListCreateAPIView):
@@ -1857,7 +2356,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -1891,31 +2393,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class NetworkParameterNew(GenericAPIView):
- serializer_class = NetworkParameterSerializer
- id_serializer_class = NetworkParameterIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = NetworkParameter()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class SiteList(generics.ListCreateAPIView):
@@ -1938,7 +2415,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -1972,31 +2452,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class SiteNew(GenericAPIView):
- serializer_class = SiteSerializer
- id_serializer_class = SiteIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = Site()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class SliceRoleList(generics.ListCreateAPIView):
@@ -2019,7 +2474,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -2053,31 +2511,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class SliceRoleNew(GenericAPIView):
- serializer_class = SliceRoleSerializer
- id_serializer_class = SliceRoleIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = SliceRole()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class TagList(generics.ListCreateAPIView):
@@ -2100,7 +2533,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -2134,31 +2570,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class TagNew(GenericAPIView):
- serializer_class = TagSerializer
- id_serializer_class = TagIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = Tag()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class InvoiceList(generics.ListCreateAPIView):
@@ -2181,7 +2592,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -2215,31 +2629,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class InvoiceNew(GenericAPIView):
- serializer_class = InvoiceSerializer
- id_serializer_class = InvoiceIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = Invoice()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class SlicePrivilegeList(generics.ListCreateAPIView):
@@ -2262,7 +2651,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -2296,31 +2688,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class SlicePrivilegeNew(GenericAPIView):
- serializer_class = SlicePrivilegeSerializer
- id_serializer_class = SlicePrivilegeIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = SlicePrivilege()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class PlanetStackRoleList(generics.ListCreateAPIView):
@@ -2343,7 +2710,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -2377,31 +2747,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class PlanetStackRoleNew(GenericAPIView):
- serializer_class = PlanetStackRoleSerializer
- id_serializer_class = PlanetStackRoleIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = PlanetStackRole()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class NetworkSliverList(generics.ListCreateAPIView):
@@ -2424,7 +2769,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -2458,31 +2806,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class NetworkSliverNew(GenericAPIView):
- serializer_class = NetworkSliverSerializer
- id_serializer_class = NetworkSliverIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = NetworkSliver()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class NetworkDeploymentsList(generics.ListCreateAPIView):
@@ -2505,7 +2828,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -2539,31 +2865,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class NetworkDeploymentsNew(GenericAPIView):
- serializer_class = NetworkDeploymentsSerializer
- id_serializer_class = NetworkDeploymentsIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = NetworkDeployments()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class FlavorList(generics.ListCreateAPIView):
@@ -2586,7 +2887,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -2620,31 +2924,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class FlavorNew(GenericAPIView):
- serializer_class = FlavorSerializer
- id_serializer_class = FlavorIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = Flavor()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class ProjectList(generics.ListCreateAPIView):
@@ -2667,7 +2946,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -2701,31 +2983,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class ProjectNew(GenericAPIView):
- serializer_class = ProjectSerializer
- id_serializer_class = ProjectIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = Project()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class SliceList(generics.ListCreateAPIView):
@@ -2748,7 +3005,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -2782,31 +3042,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class SliceNew(GenericAPIView):
- serializer_class = SliceSerializer
- id_serializer_class = SliceIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = Slice()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class NetworkList(generics.ListCreateAPIView):
@@ -2829,7 +3064,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -2863,31 +3101,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class NetworkNew(GenericAPIView):
- serializer_class = NetworkSerializer
- id_serializer_class = NetworkIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = Network()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class ServiceList(generics.ListCreateAPIView):
@@ -2910,7 +3123,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -2944,31 +3160,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class ServiceNew(GenericAPIView):
- serializer_class = ServiceSerializer
- id_serializer_class = ServiceIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = Service()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class ServiceClassList(generics.ListCreateAPIView):
@@ -2991,7 +3182,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -3025,31 +3219,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class ServiceClassNew(GenericAPIView):
- serializer_class = ServiceClassSerializer
- id_serializer_class = ServiceClassIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = ServiceClass()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class PaymentList(generics.ListCreateAPIView):
@@ -3072,7 +3241,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -3106,31 +3278,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class PaymentNew(GenericAPIView):
- serializer_class = PaymentSerializer
- id_serializer_class = PaymentIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = Payment()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class ChargeList(generics.ListCreateAPIView):
@@ -3153,7 +3300,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -3187,31 +3337,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class ChargeNew(GenericAPIView):
- serializer_class = ChargeSerializer
- id_serializer_class = ChargeIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = Charge()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class RoleList(generics.ListCreateAPIView):
@@ -3234,7 +3359,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -3268,31 +3396,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class RoleNew(GenericAPIView):
- serializer_class = RoleSerializer
- id_serializer_class = RoleIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = Role()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class UsableObjectList(generics.ListCreateAPIView):
@@ -3315,7 +3418,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -3349,31 +3455,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class UsableObjectNew(GenericAPIView):
- serializer_class = UsableObjectSerializer
- id_serializer_class = UsableObjectIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = UsableObject()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class SiteRoleList(generics.ListCreateAPIView):
@@ -3396,7 +3477,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -3430,31 +3514,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class SiteRoleNew(GenericAPIView):
- serializer_class = SiteRoleSerializer
- id_serializer_class = SiteRoleIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = SiteRole()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class SliceCredentialList(generics.ListCreateAPIView):
@@ -3477,7 +3536,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -3511,31 +3573,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class SliceCredentialNew(GenericAPIView):
- serializer_class = SliceCredentialSerializer
- id_serializer_class = SliceCredentialIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = SliceCredential()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class SliverList(generics.ListCreateAPIView):
@@ -3558,7 +3595,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -3592,31 +3632,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class SliverNew(GenericAPIView):
- serializer_class = SliverSerializer
- id_serializer_class = SliverIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = Sliver()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class NodeList(generics.ListCreateAPIView):
@@ -3639,7 +3654,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -3673,31 +3691,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class NodeNew(GenericAPIView):
- serializer_class = NodeSerializer
- id_serializer_class = NodeIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = Node()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class DashboardViewList(generics.ListCreateAPIView):
@@ -3720,7 +3713,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -3754,31 +3750,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class DashboardViewNew(GenericAPIView):
- serializer_class = DashboardViewSerializer
- id_serializer_class = DashboardViewIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = DashboardView()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class ImageDeploymentsList(generics.ListCreateAPIView):
@@ -3801,7 +3772,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -3835,31 +3809,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class ImageDeploymentsNew(GenericAPIView):
- serializer_class = ImageDeploymentsSerializer
- id_serializer_class = ImageDeploymentsIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = ImageDeployments()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class ReservedResourceList(generics.ListCreateAPIView):
@@ -3882,7 +3831,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -3916,31 +3868,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class ReservedResourceNew(GenericAPIView):
- serializer_class = ReservedResourceSerializer
- id_serializer_class = ReservedResourceIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = ReservedResource()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class NetworkSliceList(generics.ListCreateAPIView):
@@ -3963,7 +3890,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -3997,31 +3927,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class NetworkSliceNew(GenericAPIView):
- serializer_class = NetworkSliceSerializer
- id_serializer_class = NetworkSliceIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = NetworkSlice()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class UserDashboardViewList(generics.ListCreateAPIView):
@@ -4044,7 +3949,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -4078,31 +3986,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class UserDashboardViewNew(GenericAPIView):
- serializer_class = UserDashboardViewSerializer
- id_serializer_class = UserDashboardViewIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = UserDashboardView()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class PlanetStackPrivilegeList(generics.ListCreateAPIView):
@@ -4125,7 +4008,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -4159,31 +4045,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class PlanetStackPrivilegeNew(GenericAPIView):
- serializer_class = PlanetStackPrivilegeSerializer
- id_serializer_class = PlanetStackPrivilegeIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = PlanetStackPrivilege()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class UserList(generics.ListCreateAPIView):
@@ -4206,7 +4067,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -4240,31 +4104,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class UserNew(GenericAPIView):
- serializer_class = UserSerializer
- id_serializer_class = UserIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = User()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class DeploymentList(generics.ListCreateAPIView):
@@ -4287,7 +4126,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -4321,31 +4163,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class DeploymentNew(GenericAPIView):
- serializer_class = DeploymentSerializer
- id_serializer_class = DeploymentIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = Deployment()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class ReservationList(generics.ListCreateAPIView):
@@ -4368,7 +4185,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -4402,31 +4222,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class ReservationNew(GenericAPIView):
- serializer_class = ReservationSerializer
- id_serializer_class = ReservationIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = Reservation()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class SliceDeploymentsList(generics.ListCreateAPIView):
@@ -4449,7 +4244,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -4483,31 +4281,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class SliceDeploymentsNew(GenericAPIView):
- serializer_class = SliceDeploymentsSerializer
- id_serializer_class = SliceDeploymentsIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = SliceDeployments()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class SitePrivilegeList(generics.ListCreateAPIView):
@@ -4530,7 +4303,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -4564,31 +4340,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class SitePrivilegeNew(GenericAPIView):
- serializer_class = SitePrivilegeSerializer
- id_serializer_class = SitePrivilegeIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = SitePrivilege()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class PlanetStackList(generics.ListCreateAPIView):
@@ -4611,7 +4362,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -4645,31 +4399,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class PlanetStackNew(GenericAPIView):
- serializer_class = PlanetStackSerializer
- id_serializer_class = PlanetStackIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = PlanetStack()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class UserDeploymentsList(generics.ListCreateAPIView):
@@ -4692,7 +4421,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -4726,31 +4458,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class UserDeploymentsNew(GenericAPIView):
- serializer_class = UserDeploymentsSerializer
- id_serializer_class = UserDeploymentsIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = UserDeployments()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class AccountList(generics.ListCreateAPIView):
@@ -4773,7 +4480,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -4807,31 +4517,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class AccountNew(GenericAPIView):
- serializer_class = AccountSerializer
- id_serializer_class = AccountIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = Account()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class NetworkParameterTypeList(generics.ListCreateAPIView):
@@ -4854,7 +4539,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -4888,31 +4576,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class NetworkParameterTypeNew(GenericAPIView):
- serializer_class = NetworkParameterTypeSerializer
- id_serializer_class = NetworkParameterTypeIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = NetworkParameterType()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class SiteCredentialList(generics.ListCreateAPIView):
@@ -4935,7 +4598,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -4969,31 +4635,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class SiteCredentialNew(GenericAPIView):
- serializer_class = SiteCredentialSerializer
- id_serializer_class = SiteCredentialIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = SiteCredential()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class DeploymentPrivilegeList(generics.ListCreateAPIView):
@@ -5016,7 +4657,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -5050,31 +4694,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class DeploymentPrivilegeNew(GenericAPIView):
- serializer_class = DeploymentPrivilegeSerializer
- id_serializer_class = DeploymentPrivilegeIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = DeploymentPrivilege()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class DeploymentRoleList(generics.ListCreateAPIView):
@@ -5097,7 +4716,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -5131,31 +4753,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class DeploymentRoleNew(GenericAPIView):
- serializer_class = DeploymentRoleSerializer
- id_serializer_class = DeploymentRoleIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = DeploymentRole()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class UserCredentialList(generics.ListCreateAPIView):
@@ -5178,7 +4775,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -5212,31 +4812,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class UserCredentialNew(GenericAPIView):
- serializer_class = UserCredentialSerializer
- id_serializer_class = UserCredentialIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = UserCredential()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class SiteDeploymentsList(generics.ListCreateAPIView):
@@ -5259,7 +4834,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -5293,31 +4871,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class SiteDeploymentsNew(GenericAPIView):
- serializer_class = SiteDeploymentsSerializer
- id_serializer_class = SiteDeploymentsIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = SiteDeployments()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class SliceTagList(generics.ListCreateAPIView):
@@ -5340,7 +4893,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -5374,31 +4930,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class SliceTagNew(GenericAPIView):
- serializer_class = SliceTagSerializer
- id_serializer_class = SliceTagIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = SliceTag()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class NetworkTemplateList(generics.ListCreateAPIView):
@@ -5421,7 +4952,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -5455,31 +4989,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class NetworkTemplateNew(GenericAPIView):
- serializer_class = NetworkTemplateSerializer
- id_serializer_class = NetworkTemplateIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = NetworkTemplate()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class RouterList(generics.ListCreateAPIView):
@@ -5502,7 +5011,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -5536,31 +5048,6 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class RouterNew(GenericAPIView):
- serializer_class = RouterSerializer
- id_serializer_class = RouterIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = Router()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-
class ServiceResourceList(generics.ListCreateAPIView):
@@ -5583,7 +5070,10 @@
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
if not (serializer.is_valid()):
- raise Exception("failed serializer.is_valid: " + str(serializer.errors))
+ response = {"error": "validation",
+ "specific_error": "not serializer.is_valid()",
+ "reasons": serializer.errors}
+ return Response(response, status=status.HTTP_400_BAD_REQUEST)
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
@@ -5617,30 +5107,5 @@
# destroy() is handled by PlanetStackRetrieveUpdateDestroyAPIView
-"""
- XXX smbaker: my intent was to create a view that would return 'new' objects
- filled with defaults. I solved it another way, so this code may soon be
- abandoned.
-
-class ServiceResourceNew(GenericAPIView):
- serializer_class = ServiceResourceSerializer
- id_serializer_class = ServiceResourceIdSerializer
-
- def get(self, request, *args, **kwargs):
- return self.makenew(request, *args, **kwargs)
-
- def get_serializer_class(self):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def makenew(self, request, *args, **kwargs):
- obj = ServiceResource()
- serializer = self.get_serializer(obj)
- return Response(serializer.data)
-"""
-