Handling forms and file uploads (Simple)

Let's get data from the user. Before we begin, remember to NEVER trust user input because sooner or later someone (or someone's script) with malicious intent will try to break your application.

Getting ready

We are working from the forms.py file inside the sched directory of our project.

How to do it...

  1. Now that we have a data model, we need to present a form to the user in order to fill our database and validate user input to make sure it matches our schema. You can validate incoming data using any tools you like. We will use WTForms in our scheduler.
  2. Update requirements.txt:
  3. Then:
    $ pip install -r requirements.txt
  4. WTForms models forms with classes in a similar style ...

Get Instant Flask Web Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.