use the right REST url when saving a model that has no id
diff --git a/planetstack/core/xoslib/static/js/xoslib/xos-backbone.js b/planetstack/core/xoslib/static/js/xoslib/xos-backbone.js
index 555d827..b514ff3 100644
--- a/planetstack/core/xoslib/static/js/xoslib/xos-backbone.js
+++ b/planetstack/core/xoslib/static/js/xoslib/xos-backbone.js
@@ -29,7 +29,12 @@
var url = this.attributes.resource_uri;
if (!url) {
- url = this.urlRoot + this.id;
+ if (this.id) {
+ url = this.urlRoot + this.id;
+ } else {
+ // this happens when creating a new model.
+ url = this.urlRoot;
+ }
}
if (!url) {
@@ -253,14 +258,17 @@
modelName: "userDeployment"});
this.userDeployments = new this.userDeploymentCollection();
- this.deployment = XOSModel.extend({ urlRoot: DEPLOYMENT_API, modelName: "deployment" });
+ this.deployment = XOSModel.extend({ urlRoot: DEPLOYMENT_API,
+ modelName: "deployment",
+ defaults: xosdefaults.deployment });
this.deploymentCollection = XOSCollection.extend({ urlRoot: DEPLOYMENT_API,
relatedCollections: {"nodes": "deployment", "slivers": "deploymentNetwork", "networkDeployments": "deployment", "userDeployments": "deployment"},
model: this.deployment,
modelName: "deployment"});
this.deployments = new this.deploymentCollection();
- this.image = XOSModel.extend({ urlRoot: IMAGE_API, modelName: "image" });
+ this.image = XOSModel.extend({ urlRoot: IMAGE_API,
+ modelName: "image" });
this.imageCollection = XOSCollection.extend({ urlRoot: IMAGE_API,
model: this.image,
modelName: "image"});