对django tastype的msgpack支持。
tastypie-msgpack的Python项目详细描述
将MsgPack支持添加到 Django Tastypie。
安装
$ pip install -U tastypie-msgpack
用法
给定一个tastype资源,只需定义tastypie_msgpack.Serializer 作为资源的序列化程序:
from tastypie.resources import ModelResource from tastypie_msgpack import Serializer from myapp.models import MyModel class MyResource(ModelResource): class Meta: resource_name = "thing" queryset = MyModel.objects.all() serializer = Serializer()
您现在可以将format=msgpackarg附加到您的api url!