O'Reilly logo

Django: Visual QuickPro Guide by Steven Holzner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required