Backbone.js and Tastypie Filters

Instead of retrieving the entire record table for the Backbone collection that I defined, I find it more efficient to use the filters for the delicious cakes I created. How can I let Backbone use them? As I understand it, Backbone models / collections only point to the top-level URIs of the model.

eg. I have a Bookings model defined in Django that can be accessed via "/ api / booking", but I want to populate the Backbone Collection "/ api / booking? Room = 3", where the room number depends on the context.

+6
source share
1 answer

I found out that the basefetch () method accepts the "data" attribute, like JQuery.ajax ().

booking.fetch({ data : { "room" : 3 } }); 
+11
source

Source: https://habr.com/ru/post/895050/


All Articles