From 4cd86c126f31176922953059d68659e825dc2013 Mon Sep 17 00:00:00 2001 From: Alexei Boronine Date: Wed, 19 Sep 2012 18:21:29 -0400 Subject: [PATCH 1/5] Forget about resource_uri, we don't need it --- backbone-tastypie.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/backbone-tastypie.js b/backbone-tastypie.js index 4cb2df3..d39a5f2 100644 --- a/backbone-tastypie.js +++ b/backbone-tastypie.js @@ -4,7 +4,6 @@ }; Backbone.Tastypie.Model = Backbone.Model.extend({ - idAttribute: 'resource_uri', url: function() { var url = getValue(this, 'urlRoot') || getValue(this.collection, 'urlRoot') || urlError(); @@ -12,14 +11,9 @@ if (this.isNew()) return url; - return this.get('resource_uri'); - }, - _getId: function() { - if (this.has('id')) - return this.get('id'); - - return _.chain(this.get('resource_uri').split('/')).compact().last().value(); + return url + this.get('id'); } + }); Backbone.Tastypie.Collection = Backbone.Collection.extend({ From d2f0e9ecde58a80da5f42f725d39e0634c378c99 Mon Sep 17 00:00:00 2001 From: Alexei Boronine Date: Wed, 19 Sep 2012 18:23:37 -0400 Subject: [PATCH 2/5] Change Travis image --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6ff46b4..ecd5e73 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Backbone Tastypie [![Build Status](https://secure.travis-ci.org/amccloud/backbone-tastypie.png)](http://travis-ci.org/amccloud/backbone-tastypie]) # +# Backbone Tastypie [![Build Status](https://secure.travis-ci.org/boronine/backbone-tastypie.png)](http://travis-ci.org/boronine/backbone-tastypie) # Modifications to Backbone's Model an Collection so that they play nice with django-tastypie. Includes a way to easily paginate over a resource list and a way to access the associated meta information. ## Example ## From 1f50e8729d4ff974048b33688a8f2daef4bc57d4 Mon Sep 17 00:00:00 2001 From: Alexei Boronine Date: Wed, 19 Sep 2012 18:49:10 -0400 Subject: [PATCH 3/5] Fix tests --- backbone-tastypie.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backbone-tastypie.js b/backbone-tastypie.js index d39a5f2..45dd963 100644 --- a/backbone-tastypie.js +++ b/backbone-tastypie.js @@ -11,7 +11,7 @@ if (this.isNew()) return url; - return url + this.get('id'); + return url + this.get('id') + '/'; } }); From 4329affb07387fd82732f9a75ece5945e22370bf Mon Sep 17 00:00:00 2001 From: Alexei Boronine Date: Wed, 19 Sep 2012 19:33:19 -0400 Subject: [PATCH 4/5] Change travis image back to @amccloud's repo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ecd5e73..6ff46b4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Backbone Tastypie [![Build Status](https://secure.travis-ci.org/boronine/backbone-tastypie.png)](http://travis-ci.org/boronine/backbone-tastypie) # +# Backbone Tastypie [![Build Status](https://secure.travis-ci.org/amccloud/backbone-tastypie.png)](http://travis-ci.org/amccloud/backbone-tastypie]) # Modifications to Backbone's Model an Collection so that they play nice with django-tastypie. Includes a way to easily paginate over a resource list and a way to access the associated meta information. ## Example ## From 58b0743db202fbf7fb001d2390606685b31fb6b0 Mon Sep 17 00:00:00 2001 From: Alexei Boronine Date: Wed, 19 Sep 2012 19:48:52 -0400 Subject: [PATCH 5/5] .get('id') instead of _getId() --- backbone-tastypie.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backbone-tastypie.js b/backbone-tastypie.js index 45dd963..73ee9df 100644 --- a/backbone-tastypie.js +++ b/backbone-tastypie.js @@ -34,7 +34,7 @@ if (models) { var ids = _.map(models, function(model) { - return model._getId(); + return model.get('id'); }); url += 'set/' + ids.join(';') + '/';