I'm using Google App Engine with their webapp
framework. Is there something like Django's ForeigKey
in webapp
? i.e. I have a model and I want it to have a property/field that points at another model. Possible?
There is a db.ReferenceProperty. You need to be aware of two things when using it: automatic dereferencing (which is another datastore RPC call) and the entity being referenced is not required to exist (so you will need to manually check it).
When using db.ReferenceProperty make sure you use Appstats to avoid fetching entities in serial. Nick Johnson has an article that explains how to pre-fetch referenced entities.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With