Reputation: 3639
I'm thinking to create a property which store the key or the ID of the other entity as a reference to the entity.
I want to know two things.
1. Which data should the property store, the key or the ID?
2. What should the type of the property be? maybe StringProperty?
Upvotes: 0
Views: 38
Reputation: 35803
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
.
Upvotes: 1