Tastypie MongoDB资源
tastypie-mongodb-resource的Python项目详细描述
Tastypie的MongoDB资源
允许您为MongoDB创建美味的API。
设置
MONGODB_HOST = None MONGODB_PORT = None MONGODB_DATABASE = "database_name" # optional: MONGODB_USERNAME = None MONGODB_PASSWORD = None
用法示例
from tastypie import fields from tastypie.authorization import Authorization from tastypie_mongodb.resources import MongoDBResource, Document class DocumentResource(MongoDBResource): id = fields.CharField(attribute="_id") title = fields.CharField(attribute="title", null=True) entities = fields.ListField(attribute="entities", null=True) class Meta: resource_name = "documents" list_allowed_methods = ["delete", "get", "post"] authorization = Authorization() object_class = Document collection = "documents" # collection name
贡献者
- 费里克斯霍维(<;https://github.com/ferrix>;)
- 阿尔珀假名(<;https://github.com/tunix>;)