8. Getting User Input: Django Forms
A major part of Web applications is getting information from the user. The user enters data into controls such as text fields and list boxes, and you read that data. That’s where this chapter comes in. We’re going to display a Web form that lets the user enter data. Then we’ll read that data and even save it to disk (making it persistent) by storing that data in our database.
In particular, we’ll create a Web form that lets the user enter his or her name and favorite type of ice cream. Then we’ll read that data and save it in the data store. To do that, we’ll create a Django form, which lets us specify the controls we want to display—here, we want two text fields:
from django import forms
After creating the ...