I have a Foo
type in my Google App Engine datastore. I'd like it to link to a series of other Foo
types, call them prerequ开发者_StackOverflow社区isites
.
I can use the ListProperty
type to make a list of simple value types but I'm not sure how to do this with references. What is the recommended approach for doing this?
There's (currently) no db.ReferenceListProperty
in the datastore. You can closely approximate it with a db.ListProperty(db.Key)
; if you need to retrieve all the referenced keys, you can do a batch db.get()
on it to retrieve all the referenced entities at once.
References are just keys, which can be represented as strings, so you could use a StringListProperty to store your keys.
精彩评论