To explore the concepts in this chapter, we'll need to create a sample application. We'll make a simple contact list application that displays a user's first name, last name, birthday, and salutation based on gender. This simple example will give us the ability to change the labels for the fields as well as the date format used to show the birthday and the language used to display the salutation.
For this example project, we'll assume you are following along with the book and working in the Django project called mycompany
. If you are not, make the appropriate changes in the code for your project name. (You won't need any of the other apps we've built to follow along with this chapter.)
Start by adding a new application to your project. In the /projects/mycompany
directory, run the following command:
$ python manage.py startapp contactlist
Once the app has been created, edit mycompany/contactlist/models.py
to look like this:
from django.db import models GENDER...