Add blacklist and override project.toJSON to exclude attributes in blackList
authorrougeronj
Mon, 05 Jan 2015 13:02:41 +0100
changeset 362 8f33cbeb4f32
parent 361 a31875be59cf
child 363 934012c98dc2
Add blacklist and override project.toJSON to exclude attributes in blackList
client/js/models.js
--- a/client/js/models.js	Mon Jan 05 10:17:19 2015 +0100
+++ b/client/js/models.js	Mon Jan 05 13:02:41 2015 +0100
@@ -187,6 +187,7 @@
     // PROJECT
     var Project = Models.Project = RenkanModel.extend({
         type: "project",
+        blacklist: ['save_status',],
         relations: [
           {
             type: Backbone.HasMany,
@@ -275,6 +276,15 @@
                     })
                 );
             });
+        },
+        toJSON: function(){
+        	var json = _.clone(this.attributes);
+        	for(var attr in json) {
+        		if((json[attr] instanceof Backbone.Model) || (json[attr] instanceof Backbone.Collection) || (json[attr] instanceof RenkanModel)) {
+        			json[attr] = json[attr].toJSON();   
+        		}
+        	}
+        	return _.omit(json, this.blacklist);
         }
     });