Complete the code to import the FlaskForm base class from Flask-WTF.
from flask_wtf import [1]
The FlaskForm class is the base class for creating forms in Flask-WTF.
Complete the code to define a text input field named 'username' using WTForms.
from wtforms import StringField class LoginForm(FlaskForm): username = [1]('Username')
StringField is the correct WTForms field type for text input.
Fix the error in the code to add a required validator to the email field.
from wtforms.validators import DataRequired, Email class ContactForm(FlaskForm): email = StringField('Email', validators=[[1]])
DataRequired() ensures the field is not empty. It is the correct validator for required input.
Fill both blanks to create a password field with a length validator requiring 6 to 12 characters.
from wtforms import PasswordField from wtforms.validators import Length class RegisterForm(FlaskForm): password = PasswordField('Password', validators=[Length(min=[1], max=[2])])
The Length validator requires min=6 and max=12 to enforce password length between 6 and 12 characters.
Fill all three blanks to create a form with a submit button labeled 'Send', a CSRF token, and a text area field named 'message'.
from flask_wtf import FlaskForm from wtforms import SubmitField, TextAreaField class MessageForm(FlaskForm): message = [1]('Message') submit = [2]('Send') # CSRF protection is enabled by default with [3]
TextAreaField creates a multi-line text input, SubmitField creates a submit button, and FlaskForm enables CSRF protection automatically.