Bagaimana cara membuat instance suatu entitas dalam entitas yang sama. Yang saya inginkan adalah:
class User(ndb.model):
friends = ndb.StructuredProperty( User, repeated=True )
Bagaimana cara membuat instance suatu entitas dalam entitas yang sama. Yang saya inginkan adalah:
class User(ndb.model):
friends = ndb.StructuredProperty( User, repeated=True )
Anda dapat memperbarui model secara dinamis setelah dibuat:
class User(ndb.Model):
pass
User.friends = ndb.StructuredProperty(User, repeated=True)
User._fix_up_properties()
_fix_up_properties
deskripsi dari sumber:
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.
"""