當前位置: 首頁>>代碼示例>>Python>>正文


Python Project.find方法代碼示例

本文整理匯總了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
開發者ID:TBBack,項目名稱:dvplatform,代碼行數:13,代碼來源:handlers.py

示例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
開發者ID:EmbeddedSoftwareCaiShuPeng,項目名稱:vehicleDispatcher,代碼行數:13,代碼來源:ProjectAccess.py

示例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)
開發者ID:TBBack,項目名稱:dvplatform,代碼行數:7,代碼來源:handlers.py

示例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)
開發者ID:TBBack,項目名稱:dvplatform,代碼行數:8,代碼來源:handlers.py


注:本文中的models.Project.find方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。