从Appengine中的引用键访问一对多关系中的ReferenceProperty值?

2024-04-26 09:03:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我在Python中使用AppEngine,我有两个使用ndb的模型:

# Post model
class WikiPost(ndb.Model) :
    url  = ndb.StringProperty(required = True)
    content = ndb.TextProperty(required = True)
    date = ndb.DateProperty(auto_now_add = True)

第二种模式

class WikiPostVersion(ndb.Model) :
    r_post = ndb.KeyProperty(kind = WikiPost)
    content = ndb.StringProperty()
    date = ndb.DateProperty(auto_now_add = True)

如何访问模型WikiPostVersion的引用键r_post的值


Tags: 模型addtrueautodatemodelrequiredcontent