这是我的python视图代码。我有闪光点。但它不会显示任何类型的flash前端。在
@auth.route('/admin/project/add',methods = ['POST', 'GET'])
def addproject():
if request.method == 'POST':
projectname = request.form['projectname']
c, conn = connection()
query = "SELECT Count(id) from projects WHERE project='{}'".format(projectname)
c.execute(query)
values = c.fetchall
conn.close()
if (values == 0):
flash("success")
return render_template('addproject.html')
else:
flash("Project already exists. Please goto projects page and confirm. If it is and error, please contact devloper.")
return render_template('addproject.html')
else:
return render_template('addproject.html')
在模板中,我添加了以下内容:
^{pr2}$有人能帮我解决这个问题吗? 也可以这样做:
from flask import flash, redirect, render_template, url_for, request
需要执行:
projectname
相关问题 更多 >
编程相关推荐