July 2018
Intermediate to advanced
324 pages
8h 14m
English
We will have a simple todo form in which we have a textbox with a Submit button. It should also contain the list view to display the todo data.
The following is a code snippet of the Todo form.
File—todo/forms.py:
from flask_wtf import FlaskFormfrom wtforms import StringField, SubmitFieldfrom wtforms.validators import Required, Lengthclass TodoForm(FlaskForm): title = StringField( 'What needs to be done?', validators=[Required(), Length(1, 128)] ) submit = SubmitField('Submit')
As you can see, our Todo form is straightforward with some basic validation. It's time to use this form in views to render them into HTML template.
Read now
Unlock full access