October 2016
Intermediate to advanced
418 pages
9h 52m
English
Now, we will create a simple Game model that we will use to represent and persist games. Open the games/models.py file. The following lines show the initial code for this file, with just one import statement and a comment that indicates we should create the models:
from django.db import models # Create your models here.
The following lines show the new code that creates a Game class, specifically, a Game model in the games/models.py file. The code file for the sample is included in the restful_python_chapter_01_01 folder:
from django.db import models class Game(models.Model): created = models.DateTimeField(auto_now_add=True) name = models.CharField(max_length=200, blank=True, default='') release_date = models.DateTimeField() ...