Flask 101: How to Add a Search Form

In our last article, we added a database to our Flask web application but didn’t have a way to add anything to our database. We also didn’t have a way to view anything, so, basically, we ended up having a pretty useless web application. This article will take the time to teach you how to do the following:

Create a form to add data to our database.
Use a form to edit data in our database.
Create some kind of view of what’s in the database.

Adding forms to Flask is pretty easy too, once you figure out what extension to install. I had heard good things about WTForms so I will be using that in this tutorial. To install WTForms you will need to install Flask-WTF. Installing Flask-WTF is pretty easy; just open up your terminal and activate the virtual environment we set up in our first tutorial. Then run the following command using pip:

Link: https://dzone.com/articles/flask-101-how-to-add-a-search-form?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev