2014-04-14 50 views
0

我通過下面的行創建一個「郵報」實體:如何獲得GAE中的父實體?

post = Post(date=datetime.now(),title=postInfo['title'],body=postInfo['body'],postid=postIdForTitle(postInfo['title']),parent=author) 

其中author是數據存儲實體。

如何訪問「帖子」的父母?我試過做post.parent,但顯然「父母」是一個功能。我無法在文檔中找到它。

回答

1

試試這個:

key_name = postIdForTitle(postInfo['title']) 
parent = post.get_by_key_name(key_name).parent