WTForms ships with a number of extensions that make it easier to work with other frameworks and libraries, such as Django.
WTForms now includes support for AppEngine fields as well as auto-form generation.
See the module docstring for examples on how to use :func:`model_form`.
This extension provides templatetags to make it easier to work with Django templates and WTForms' html attribute rendering. It also provides a generator for automatically creating forms based on Django ORM models.
While linking data to most fields is fairly easy, making drop-down select lists using django ORM data can be quite repetetive. To this end, we have added some helpful tools to use the django ORM along with wtforms
This extension provides SelectField integration with SQLAlchemy ORM models, similar to those in the Django extension.
These fields are provided to make it easier to use data from ORM objects in your forms.
def enabled_categories(): return Category.query.filter_by(enabled=True) class BlogPostEdit(Form): title = TextField() blog = QuerySelectField(get_label='title') category = QuerySelectField(query_factory=enabled_categories, allow_blank=True) def edit_blog_post(request, id): post = Post.query.get(id) form = ArticleEdit(obj=post) # Since we didn't provide a query_factory for the 'blog' field, we need # to set a dynamic one in the view. form.blog.query = Blog.query.filter(Blog.author == request.user).order_by(Blog.name)