当前位置: 首页>>代码示例>>Python>>正文


Python ProjectForm.set_supervisor_choices方法代码示例

本文整理汇总了Python中forms.ProjectForm.set_supervisor_choices方法的典型用法代码示例。如果您正苦于以下问题:Python ProjectForm.set_supervisor_choices方法的具体用法?Python ProjectForm.set_supervisor_choices怎么用?Python ProjectForm.set_supervisor_choices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在forms.ProjectForm的用法示例。


在下文中一共展示了ProjectForm.set_supervisor_choices方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: edit_project2

# 需要导入模块: from forms import ProjectForm [as 别名]
# 或者: from forms.ProjectForm import set_supervisor_choices [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)
开发者ID:martinsoender,项目名称:PIS,代码行数:28,代码来源:routes.py

示例2: create_project

# 需要导入模块: from forms import ProjectForm [as 别名]
# 或者: from forms.ProjectForm import set_supervisor_choices [as 别名]
def create_project():

  if 'email' not in session:
    return redirect(url_for('home'))

  show_project = ProjectForm()
  show_project.set_supervisor_choices()

  if request.method == 'POST':
    if show_project.validate() == False:
      flash('All fields are required.')
      return render_template('create_project.html', show_project=show_project)
    else:
      new_project = project(show_project, session['email'])
      db.session.add(new_project)
      db.session.commit()
      if show_project.file.data.filename:
        os.makedirs("Project/files/" + str(newuser.id))
        filename = secure_filename(show_project.file.data.filename)
        show_project.file.data.save('Project/files/' + str(newuser.id) + "/" + filename)
      flash('Project has been created')
      return redirect(url_for('create_project'))
 
  elif request.method == 'GET':
    return render_template('create_project.html', show_project=show_project) 
开发者ID:martinsoender,项目名称:PIS,代码行数:27,代码来源:routes.py


注:本文中的forms.ProjectForm.set_supervisor_choices方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。