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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access