0PricingLogin
Flask Academy · Lesson

Render and Submit a Form

Show fields in a template and handle submit.

From Class to Page

A form class is useless until a user can see it. Now you will render those fields into HTML and accept the submission back. 🖋️

Pass the Form to the Template

Create the form in your view and hand it to render_template. The template gets a live object full of fields it can draw.

form = LoginForm()
return render_template('login.html', form=form)

All lessons in this course

  1. Define a FlaskForm Class
  2. Render and Submit a Form
  3. validate_on_submit and CSRF Tokens
  4. Custom Validators and Field Errors
← Back to Flask Academy