flask渲染模板时报错TypeError: 'UnboundField' object is not callable --

渲染模板时,访问页面提示TypeError: 'UnboundField' object is not callable

检查代码,发现实例化表单类是,没有加括号:form = NewNoteForm,加了括号后就解决了form = NewNoteForm()

@app.route('/index')
def index():
form = NewNoteForm
notes = Note.query.all()
return render_template('index.html', notes=notes, form=form)

 


posted @ 2019-03-22 22:23  夏晓旭  阅读(1151)  评论(0编辑  收藏  举报