PUT is handled as a POST instead, resulting in server error
bmcmahen opened this issue · 2 comments
I've run into some troubles using backbone-tastypie. I have a model like this:
var Movie = Backbone.Model.extend({
urlRoot: "/recipe/api/v1/movie/",
initialize: function(){
this.on('all', function(e) {
console.log(this.get('title'));
});
}
});
ar mov = new Movie({id:2});
And then I attempt to save it...
mov.save()
in which case, it should attempt to do a PUT instead of a post. But for some reason, it attempts to do a POST... giving me the following error:
POST http://127.0.0.1:8000/movie/api/v1/movie/2/ 501 (NOT IMPLEMENTED)
If I remove the tastypie-backbone.js script, the above code works properly -- requesting a PUT and updating the movie entry appropriately. Any idea on what's going on? I'm using backbone 0.9.2.
I got this too. But its because model.isNew() returns true which is because there is no model.id
I had cargo-culted this from an example:
$.app.Area = Backbone.RelationalModel.extend({
urlRoot: '/api/v1/area/',
//idAttribute: '_id'
});
removing the idAttribute, now I get:
id: "/api/v1/area/1/"
and it correctly identifies it as existing and does a PUT
Sounds like this got fixed?