validate_on_submit and CSRF Tokens
Process valid posts and block forgeries.
The Golden Method
Flask-WTF gives you one method that checks everything at once. validate_on_submit is the heart of safely processing any form. 🔑
What It Actually Checks
validate_on_submit returns True only when the request is a POST and every validator passes. One call covers both conditions.
if form.validate_on_submit():
pass # safe to use the dataAll lessons in this course
- Define a FlaskForm Class
- Render and Submit a Form
- validate_on_submit and CSRF Tokens
- Custom Validators and Field Errors