Summary

In this chapter, we added a variety of new ways to interact with the site. It is now possible to create and modify content directly through the site. We discussed how to create object-oriented forms with WTForms, including processing and validating the form data from the view, as well as writing that form data to the database. We also created templates to display forms and validation errors and used Jinja2 macros to remove repetitive code to make the code more modular. We were then able to display single-use flash messages to the user when they perform an action. Finally we also explained how to handle file uploads using WTForms and Flask, and to serve static assets, such as JavaScript, stylesheets, and image uploads.

Before jumping into ...

Get Learning Flask Framework now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.