/ Published in: Python
Expand |
Embed | Plain Text
1. 設定方法 class MyModelRoot(db.Model): text = db.StringProperty() date = db.DateTimeProperty(auto_now_add=True) class MyModel(db.Model): text = db.StringProperty() date = db.DateTimeProperty(auto_now_add=True) # 親子関係を作らない。 model = MyModel(text="hoge") # 親子関係を作る。 root = MyModelRoot(text="fuga") model = MyModel(parent=root, text="hoge") # parent=root, 1. parentを指定した取得方法 "ANCESTOR IS"を使用する。 parentKey = 1 root = MyModelRoot.get_by_id(key) models = MyModel.gql("WHERE ANCESTOR IS :parent", parent=root)
You need to login to post a comment.
