2π
β
I donβt think you should be loading templates in a model
. The loading and rendering of templates would usually be the job of the view
. Try loading the HTML directly with AJAX in the render
method of your view
:
var ItemView = Backbone.View.extend({
render: function(){
var that = this;
$.get('/item/123', function(html){
that.$el.html(html);
});
return this;
}
});
π€net.uk.sweet
0π
If you havent already, have a look at the django-app Tastypie, its the go-to solution for backend to backbone and similar apps.
Without seing the code its hard to tell how much work it would be to move it all into Tastypie vs rolling your own solutions on a per-case basis, look over the documentation.
π€krs
Source:stackexchange.com