Book Image

Learning Flask Framework

Book Image

Learning Flask Framework

Overview of this book

Table of Contents (17 chapters)
Learning Flask Framework
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

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 the next chapter, take some time to experiment with the new features we added to the site. Here are some ideas for ways you can improve on what we've built in this chapter:

  • Add a header link to the image upload form.

  • In the image upload view, validate...