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

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

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

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

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

05-08 15:19