it seems django tastypie json produces foreign keys value matches full resource_uri of related model. yui3s model-relate expects json foreign keys id of related field. there setting in yui model-relate or in tastypie resource definitions these 2 frameworks talking easily?
the problem in model definitions. specifically, had "root" attribute in wrong place. once fixed that, model-relate , tastypie started behaving expected.
y.workerprofilemodel = y.base.create( 'workerprofilemodel', y.model, [y.modelrelate, y.modelsync.rest], { root: '/api/v1/workerprofile/'}, { attrs: { user: {}, shortcode: {} } } ); y.requesteventmodel = y.base.create( 'requesteventmodel', y.model, [y.modelrelate, y.modelsync.rest], { root: '/api/v1/requestevent/' }, { attrs: { requesttype: {}, requeststatus: {} }, relationships: { workerprofile: { type: 'toone', key: 'id', relatedmodel: 'workerprofilemodel', relatedkey: 'workerprofileid' } } } );
Comments
Post a Comment