本文整理匯總了Python中project.model.Project.save方法的典型用法代碼示例。如果您正苦於以下問題:Python Project.save方法的具體用法?Python Project.save怎麽用?Python Project.save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類project.model.Project
的用法示例。
在下文中一共展示了Project.save方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_project_update
# 需要導入模塊: from project.model import Project [as 別名]
# 或者: from project.model.Project import save [as 別名]
def test_project_update():
project = Project()
project.find('test project update')
project.project.description = 'project updated'
project.save()
db = MongoModel(project='internal',collection='project')
temp = db.query({'name':'test project update'})
assert temp['description'] == 'project updated'
示例2: project_view
# 需要導入模塊: from project.model import Project [as 別名]
# 或者: from project.model.Project import save [as 別名]
def project_view(project_id):
form = ProjectUpdateForm(csrf_enabled=False)
project = Project()
print project_id
project.get(project_id)
permission = EditProjectPermission(project_id)
edit = False
if request.method == 'POST':
edit = True
if not permission.can():
abort(403)
if form.validate_on_submit():
# name is not edited because it bind to the database name
project.project.description = form.description.data
project.save()
return render_template('project_view.html',project=project,form=form,edit=edit,permission=permission)