Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 2.7 在Google App Engine python ndb中的同一实体内创建实体的实例_Python 2.7_Google App Engine_Google Cloud Datastore_App Engine Ndb - Fatal编程技术网

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.
    """