Python 如何在django tastypie json上追加success=true

Python 如何在django tastypie json上追加success=true,python,django,extjs,tastypie,Python,Django,Extjs,Tastypie,我使用django tastypie实现restapi,我使用sencha作为移动客户端。出于某种目的,我需要操纵响应文本 如下 form.submit({ success: function() { // The callback function is run when the user taps the 'ok' button form.reset(); //Ext.Msg.alert('Thank You', 'Your mess

我使用django tastypie实现restapi,我使用sencha作为移动客户端。出于某种目的,我需要操纵响应文本

如下

form.submit({
    success: function() {
        // The callback function is run when the user taps the 'ok' button
        form.reset();

        //Ext.Msg.alert('Thank You', 'Your message has been received', function() {
        //  form.reset();
        //});
    }
});
我有如下的json响应

{"meta": {"limit": 20, "next": null, "offset": 0, "previous": null, "total_count": 13},       
 "objects": [{"body": "This will prbbly be my lst edited  post.", "id": 1,
 "pub_date":  "2011-05-22", "resource_uri": "/api/v1/entry/1/", "slug": "another-post", 
 "title": "Another Post"}, {"body": "This will prbbly be my lst post.", "id": 2, 
 "pub_date": "2011-05-22", "resource_uri": "/api/v1/entry/2/", "slug": "another-post", 
 "title": "Another Post"}, {"body": "This will prbbly be my lst edited  post"}]}
发送success=>true非常重要 如果未定义success或success不等于true,则它将被视为表单提交错误。
如何在django tastypie json上追加success=true如果我正确理解了您的问题,您希望在API调用的结果中追加
{'success':true}
,对吗?如果是这样,您可以覆盖
资源
类上的方法:

def dehydrate(self, bundle):
    bundle.data['success'] = True
    return bundle

对于所有的请求类型,如
GET
,是否都会这样做?