views:

37

answers:

2

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 prerequisites.

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?

A: 

References are just keys, which can be represented as strings, so you could use a StringListProperty to store your keys.

Adam Crossland
You can also use a `db.ListProperty(db.Key)` property to store the `db.Key` objects directly.
Will McCutchen
+2  A: 

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.

Nick Johnson