本文整理汇总了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)