本文整理汇总了Python中models.Project.find方法的典型用法代码示例。如果您正苦于以下问题:Python Project.find方法的具体用法?Python Project.find怎么用?Python Project.find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Project
的用法示例。
在下文中一共展示了Project.find方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: api_save_project
# 需要导入模块: from models import Project [as 别名]
# 或者: from models.Project import find [as 别名]
def api_save_project(request, *, id, title, summary):
if not title or not title.strip():
raise APIValueError('title', 'title cannot be empty.')
if not summary or not summary.strip():
raise APIValueError('summary', 'summary cannot be empty.')
project = yield from Project.find(id)
project.status = True
project.title = title
project.summary =summary
yield from project.update()
return project
示例2: getAllProject
# 需要导入模块: from models import Project [as 别名]
# 或者: from models.Project import find [as 别名]
def getAllProject():
projectList = []
for item in Project.find():
project = {
'id' : item['id'],
'name' : item['name'],
'description' : item['description'],
}
projectList.append(project)
return projectList
示例3: api_delete_project
# 需要导入模块: from models import Project [as 别名]
# 或者: from models.Project import find [as 别名]
def api_delete_project(request, *, id):
check_admin(request)
project = yield from Project.find(id)
yield from project.remove()
return dict(id=id)
示例4: api_get_project
# 需要导入模块: from models import Project [as 别名]
# 或者: from models.Project import find [as 别名]
def api_get_project(*, id):
project = yield from Project.find(id)
charts = yield from Chart.findAll('project_id=?', [id], orderBy='created_at desc')
for chart in charts:
chart.option = json.loads(chart.option)
return dict(project=project, charts=charts)