本文整理汇总了Python中forms.ProjectForm.setFormContentFromProject方法的典型用法代码示例。如果您正苦于以下问题:Python ProjectForm.setFormContentFromProject方法的具体用法?Python ProjectForm.setFormContentFromProject怎么用?Python ProjectForm.setFormContentFromProject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类forms.ProjectForm
的用法示例。
在下文中一共展示了ProjectForm.setFormContentFromProject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: edit_project2
# 需要导入模块: from forms import ProjectForm [as 别名]
# 或者: from forms.ProjectForm import setFormContentFromProject [as 别名]
def edit_project2(project_id):
if 'email' not in session:
return redirect(url_for('home'))
project_By_ID = project.query.filter_by(id = project_id).first_or_404()
show_project = ProjectForm()
show_project.set_supervisor_choices()
show_project.setFormContentFromProject(project_By_ID)
if request.method == 'POST':
show_project = ProjectForm()
show_project.set_supervisor_choices()
if show_project.validate() == False:
flash('Please fill out everything')
return render_template('edit_project.html', show_project=show_project, projectByID = project_By_ID)
else:
project_By_ID.updateProject(show_project)
db.session.add(project_By_ID)
db.session.commit()
return redirect(url_for('home'))
elif request.method == 'GET':
return render_template('edit_project.html', show_project=show_project, projectByID = project_By_ID)