The Datastore has a special property type for this: ReferenceProperty
. There are two ways to use it.
One:
someothermodel = db.ReferenceProperty()
Two:
someotherspecificmodel = db.ReferenceProperty(SomeModel)
In example 2, only models with the type of SomeModel can be assigned, in example one, any model can be assigned.
The value type of ReferenceProperty
is db.Key
.