【发布时间】:2015-02-04 12:59:54
【问题描述】:
我正在tastepie中编写Rest API并创建如下自定义资源
class Myresource(Resource):
def obj_create(self, request, **kwargs):
# logic when POST request is called
# here if some error occurs while inserting data I want to add my custom error message and return it response.
return bundle
如何从 obj_create 消息返回自定义错误消息。现在我正在处理异常,但 sweetpie 总是返回 201。
【问题讨论】: