0
我是django tastypie modelresource中的新成员。这是我使用tastypie更新数据的代码。如何使用方法PUT以正确的方式编写代码。Django Tastypie ModelResource:使用Json格式更新数据
class OrderAerialStatusResources(ModelResource):
user_id = fields.CharField(attribute='user_id')
def determine_format(self, request):
return 'application/json'
class Meta:
queryset = Order.objects.all()
list_allowed_methods = ['get','put']
resource_name = 'order_status'
authorization = Authorization()
fields = ['id','status']
filtering = {
"id": ALL,
}
我已经尝试过您的代码,我得到这个错误400错误的请求 “错误”:“无效的数据发送” – nuriffah
你发送了什么数据,你能向我展示浏览器的更多控制台输出吗? – SimonShyu
这是我的数据:{“status”:40}这是我的url localhost:8000/rest/v1/order_status /?id = 2 – nuriffah