Python 2.7 在Google App Engine python ndb中的同一实体内创建实体的实例
如何在同一实体中创建实体的实例。我想要的是:Python 2.7 在Google App Engine python ndb中的同一实体内创建实体的实例,python-2.7,google-app-engine,google-cloud-datastore,app-engine-ndb,Python 2.7,Google App Engine,Google Cloud Datastore,App Engine Ndb,如何在同一实体中创建实体的实例。我想要的是: class User(ndb.model): friends = ndb.StructuredProperty( User, repeated=True ) 您可以在创建模型后动态更新模型: class User(ndb.Model): pass User.friends = ndb.StructuredProperty(User, repeated=True) User._fix_up_properties() \u修复属性来源描
class User(ndb.model):
friends = ndb.StructuredProperty( User, repeated=True )
您可以在创建模型后动态更新模型:
class User(ndb.Model):
pass
User.friends = ndb.StructuredProperty(User, repeated=True)
User._fix_up_properties()
\u修复属性
来源描述:
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.
"""