Reputation: 146
In referencing models with KeyProperty it seems one has to initialize the model before its referenced Have I missed some bit of information here?
from google.appengine.ext import ndb
#initialize here
class Vessel(ndb.Model):
pass
class Manifest(ndb.Model):
vessellist = ndb.KeyProperty(Vessel)
class Vessel(ndb.Model):
manifest = ndb.KeyProperty(Manifest)
Upvotes: 0
Views: 56
Reputation: 1839
This is normal behavior. If you want to avoid putting your models in a specific order and you want cross references like that, you can reference a model with a string instead of the model class:
class Manifest(ndb.Model):
vessellist = ndb.KeyProperty('Vessel')
class Vessel(ndb.Model):
manifest = ndb.KeyProperty('Manifest')
Upvotes: 3