Python task manager from scratch, part 20: Adding a form

Now that we've prepared the way, adding the form is straightforward. (I made several small mistakes implementing this section. I found and fixed them much faster in the knowledge that the basic routing and HTTP method handling was working correctly.)

The tools you need to build this form are:

  1. Knowing the general structure of an HTML form.
  2. Knowing how to put an input field on an HTML form.
  3. Knowing different types of input fields (I found datetime-local useful).
  4. Knowing how to use the Bottle request object to pull information from a form field in the function.
  5. Knowing how to convert the ISO-formatted datetime object into a Python datetime object.

All of these are readily Googlable and are also demonstrated at the current commit of the veery/ repository.

By the way, if you're new to this end of things: I find debugging this stuff more dispiriting than debugging in other subdomains. There's a whole world of Internet knowledge: layers of protocols, error messages to be half-understood, semi-interoperable subsystems... for my psychology, it's a difficult combination. Whenever you feel this way, it's a good time to go slow, keep your commits very small, and make flashcards to help yourself retain what seem to be the most important things you keep forgetting.

Next post: Python task manager from scratch, part 21: Preparing the way III

Home page