def gen_default_api_endpoints(cls):
e = engine()
model_name = cls.schema.Meta.model.__name__.lower()
identifier = e.plural(model_name)
rv = {
'/%s/' %identifier: {
'endpoint': '%s-collection' %model_name,
'methods': ['GET', 'POST']
},
'/%s/<int:pk>/' %identifier: {
'endpoint': '%s-resource' %model_name,
'methods': ['GET', 'PUT', 'DELETE']
},
}
return rv
评论列表
文章目录