私の見解 。
class EventRVSPResource(ModelResource):
event = fields.ForeignKey(EventResource, 'event')
created_by = fields.ForeignKey(UserResource, 'created_by')
class Meta:
queryset = EventRsvp.objects.all()
authorization = Authorization()
resource_name = 'eventrvsp'
filtering = {
'event':ALL_WITH_RELATIONS,
'created_by': ALL,
}
ただし、curlを使用してデータを送信すると正常に機能します。201を示しています
curl --dump-header - -H "Content-Type: application/json" -X POST --data '{"created_by": "/mobapp/api/v1/user/1/","event": "/mobapp/api/v1/eventlist/5/","notes": "Going","past_status": "DG","status": "Y"}' http://192.168.1.8:9000/mobapp/api/v1/eventrvsp/
django-tastypieへの私のHttpリクエスト.しかし、それでもエラーが表示されます.何が悪いのかわかりません
var url = "http://192.168.1.8:9000/mobapp/api/v1/eventrvsp/";
var client = Ti.Network.createHTTPClient({
// function called when the response data is available
onload : function(e) {
Ti.API.info("Received text: " + this.responseText);
alert('success');
},
// function called when an error occurs, including a timeout
onerror : function(e) {
Ti.API.debug();
alert(e.error);
},
timeout : 5000 // in milliseconds
});
// Prepare the connection.
client.open("POST", url);
// Send the request.
client.send({"created_by": "/mobapp/api/v1/user/1/","event": "/mobapp/api/v1/eventlist/4/","notes": "Going","past_status": "DG","status": "Y"});