Sunday, February 03, 2013

javascript - Enable Django and Tastypie support for trailing slashes? - Stack Overflow

javascript - Enable Django and Tastypie support for trailing slashes? - Stack Overflow: "For a Backbone solution:

You can overwrite the default behavior of Model.url, even using the normal one and making a small modification like the one you are looking for:

// code simplified and not tested
var MyModel: Backbone.Model.extend({
url: function() {
var original_url = Backbone.Model.prototype.url.call( this );
var parsed_url = original_url + ( original_url.charAt( original_url.length - 1 ) == '/' ? '' : '/' );

return parsed_url;
}
});"

'via Blog this'