以下是tastypie中的资源
class MyResource(Resource):
field1 = fields.CharField(attribute='field1')
field2 = fields.CharField(attribute='field2')
def get_object_list(self, request):
# Query for objects
return obj_list
def obj_get_list(self, request=None, **kwargs):
self.get_object_list(kwargs['bundle'].request)