这是我的WTForm
from flask.ext.wtf import Form
from wtforms import TextField, PasswordField, SelectMultipleField,HiddenField,validators
from wtforms.validators import Required, Email, EqualTo
class CreateCar(Form):
id = HiddenField ('id')
plaque_no = TextField('plaque_no', [Required(message='pn')])
plaque_img = TextField('plaque_img', [Required(message='pi')])
这是我的Flask观点:
def manage(task=None,id=None):
form = CreateCar
return render('MyHTML.html', form=form)
每当我试图在我的表单字段上尝试:
{% for item in form %}
{{ item }}
{% endfor %}
我收到此错误:
TypeError: 'FormMeta' object is not iterable
我的表格有什么问题? 感谢
答案 0 :(得分:5)
你只是想念CreateCar上的()。
def manage(task=None,id=None):
form = CreateCar() #HERE
return render('MyHTML.html', form=form)