/ Published in: Python
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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)