Getting Model.id From Backbone.js Collection Create Success Call Using Tastypie?
I used to be able to get my model.id from a newly created backbone collection.create call via the following example code: OPTS['success'] = function( response, model, options ){
Solution 1:
I actually found the problem today, it was I was using namespaces with the tastypie urls:
urlpatterns += patterns('', (r'^api/', include(v1_api.urls)))
was changed to this
urlpatterns += patterns('', (r'^api/', include(v1_api.urls),namespace='api'))
for unit testing purposes, but this created an issue with reverse calls in the tastypie framework itself, and in the end it changed the response.location header to not include the url to the actual model itself after the create (POST) call was made. Remove the namespace fixed this problem
Post a Comment for "Getting Model.id From Backbone.js Collection Create Success Call Using Tastypie?"