Cannot import name 'TextField' from 'wtforms'
This page explains How to Fix ImportError: cannot import name 'TextField' from 'wtforms'
Last updated
Was this helpful?
This page explains How to Fix ImportError: cannot import name 'TextField' from 'wtforms'
Last updated
Was this helpful?
is a flexible forms validation and rendering library for Python web development. It can work with whatever web framework and template engine you choose. It supports data validation, CSRF protection, internationalization (I18N).
Solution 1 - Replace
TextField
type withStringField
Note: This solution works with WTForms 3.x and 2.x versions
Solution 2 - Use the latest stable 2.x version of WTForms
Using an older version provides a quick fix for your codebase but is not recommended in the long run.
The above error occurs when the TextField
property is used with version 3.0 or above because the wtforms.TextField
deprecated in favor of wtforms.StringField
.
- official documentation
- library documentation
Join the community on .