Lists and Items‎ > ‎

Step 1: Data and Purpose

Next Step >

There is a simple data model that reflects the purpose of the application

What will I do with this application? I will create lists, with items. So, let's define List and Item, two different Datastore models derived from the 'db' class ... db is a Google App Engine wrapper for the Datastore API, which reads and writes from Google's Big Table (or, in the development environment on your own machine, a simulation of Big Table).

Code Note: the relationship between List and Item is made explicit by Item's "ReferenceProperty (List)" declaration, in bold. When the time comes, Item's list_key will be assigned the instance of List that the Item belongs to.

class List(db.Model):
  name = db.StringProperty(multiline=True)

class Item(db.Model):
  list_key = db.ReferenceProperty(List)
  name = db.StringProperty(multiline=True)

General Note: if you are using these steps to guide the development of a different application, it's good to keep data models that are understood visually separate from your exploratory models, or your exploratory properties.