Django tastypie,如何访问ModelResource类中post_列表创建的对象

Django tastypie,如何访问ModelResource类中post_列表创建的对象,django,python-2.7,tastypie,Django,Python 2.7,Tastypie,这是我的tastypie代码片段 class MycustomeResource(ModelResource): asdf = fields.IntegerField('asdf', null=True) adsfasd = fields.IntegerField('adsfasd') class Meta: always_return_data = True queryset = Mycustome.objects.all()

这是我的tastypie代码片段

class MycustomeResource(ModelResource):
    asdf = fields.IntegerField('asdf', null=True)
    adsfasd = fields.IntegerField('adsfasd')

    class Meta:
        always_return_data = True
        queryset = Mycustome.objects.all()


    def post_list(self, request, **kwargs):

        object_temp = super(MycustomeResource, self).post_list(request, **kwargs)

        return object_temp
这里
post\u list
正在对象上创建,我想要那个对象,这样我就可以对它执行操作


我是否需要重写对象创建方法来获取对象?

是的,post\u list方法调用ModelResource类的对象创建方法,您可以像这样访问其中的对象:

def obj_create(self, bundle, request=None, **kwargs):
    bundle = super(MycustomeResource, self).obj_create(bundle, request)

    '''
    operations with your object bundle.obj
    '''
    return bundle

好的,谢谢你,在哪里写这个obj_创建函数。?在你的modelResource中。