【发布时间】:2014-08-24 11:04:46
【问题描述】:
如何在同一实体中创建实体的实例。我想要的是:
class User(ndb.model):
friends = ndb.StructuredProperty( User, repeated=True )
【问题讨论】:
标签: python-2.7 google-app-engine google-cloud-datastore app-engine-ndb
如何在同一实体中创建实体的实例。我想要的是:
class User(ndb.model):
friends = ndb.StructuredProperty( User, repeated=True )
【问题讨论】:
标签: python-2.7 google-app-engine google-cloud-datastore app-engine-ndb
模型创建后可以动态更新:
class User(ndb.Model):
pass
User.friends = ndb.StructuredProperty(User, repeated=True)
User._fix_up_properties()
_fix_up_properties 来源描述:
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.
"""
【讨论】: