from flask import Blueprint, render_template, abort
from flask.ext.wtf import Form
import os
from jinja2 import TemplateNotFound
from models import Member
from wtforms.ext.sqlalchemy.orm import model_form
@simple_page.route('/register')
def register():
form = model_form(Member, Form)
return render_template('register.html', form=form, name="bad")
class Member(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(50), nullable=False)
email = db.Column(db.String(50), nullable=False, unique=True)
和我認爲:
<p class="txt11 colorb">
{{ form.name }}
</p>
此輸出<UnboundField(TextField,(), {u'default': None, u'filters': [], u'validators': [<wtforms.validators.Required object at 0x7f62f59b5590>, <wtforms.validators.Length object at 0x7f62f59b55d0>]})>
,並非實際場。我如何獲得與該平臺的實際表單/字段?
你能用你正在使用的導入來更新你的問題嗎? – 2013-05-07 04:51:27
我已添加進口 – tipu 2013-05-07 05:20:52
從哪裏導入'model_form'? – 2013-05-07 05:21:50