gpt4 book ai didi

flask - Flask:validate_on_submit始终为false,form.errors为空

转载 作者:行者123 更新时间:2023-12-03 17:26:35 24 4
gpt4 key购买 nike

validate_on_submit始终为false,并且form.errors为空。我什么都不知道提示?谢谢。

app.py:

def set_comment(page):
f = form.CommentForm()
if f.validate_on_submit():
db.set_comment(f.text.data, datetime.datetime.utcnow(), page, 1)
else:
flash(f.errors)


表格

class CommentForm(Form):
text = TextField('Message')


show.html

<div id="post_comment">
<form action="" method="post" name="comment">
{{form.hidden_tag()}}
{{form.text}}
</div>

最佳答案

我在表单中缺少正确的URL的操作URL。

关于flask - Flask:validate_on_submit始终为false,form.errors为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43172275/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com