/ Published in: Python
ã¿ãŸã„ãªã‚«ãƒ³ã‚¸ã§ã€Œä¿æŒã™ã‚‹modelåã®å°æ–‡å—+"_set"ã€ã§ã¶ã‚‰ã•ãŒã‚‹Entityã®ãƒªã‚¹ãƒˆã‚’å–å¾—ã§ãる。ã“ã®å称ã¯ReferencePropertyã®ã‚³ãƒ³ã‚¹ãƒˆãƒ©ã‚¯ã‚¿ã®collection_name引数ã§æŒ‡å®šã™ã‚‹äº‹ã‚‚ã§ãる。
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
class MyModel1(db.Model): text = db.StringProperty() class MyModel2(db.Model) text = db.StringProperty() myModel1 = db.ReferenceProperty(MyModel1) myModel1 = MyModel1.get_by_id(1) myModel2s = MyModel1.mymodel2_set