Reputation: 77
How do i create instances of an entity within the same entity. What i want is :
class User(ndb.model):
friends = ndb.StructuredProperty( User, repeated=True )
Upvotes: 0
Views: 75
Reputation: 6201
You can update model dynamically after it was created:
class User(ndb.Model):
pass
User.friends = ndb.StructuredProperty(User, repeated=True)
User._fix_up_properties()
_fix_up_properties
description from the sources:
def _fix_up_properties(cls):
"""Fix up the properties by calling their _fix_up() method.
Note: This is called by MetaModel, but may also be called manually
after dynamically updating a model class.
"""
Upvotes: 1