O'Reilly logo

Django 1.2 e-commerce by Jesse Legg

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

The customer profile

We will now build a very lightweight profile model to store additional information about our customers. The Customer model will initially include three fields: a ForeignKey to the User model, an address, and a phone number. Because the profile model is simply a regular Django model class, any additional information can be added using the usual fields.

To simplify this model design slightly, we will also be creating a CustomerAddress model that represents a specific address. It will include fields such as three lines of address information (apartment number, street name, and so on), city, postal code, and state information. The CustomerAddress model will be referenced as a ForeignKey from the Customer profile.

Here is the sample ...

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