Return to Snippet

Revision: 10137
at December 9, 2008 13:41 by tamuratetsuya


Initial Code
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

Initial URL


Initial Description
みたいなカンジで「保持するmodel名の小文字+"_set"」でぶらさがるEntityのリストを取得できる。この名称はReferencePropertyのコンストラクタのcollection_name引数で指定する事もできる。

Initial Title
ReferencePropertyのときの外部キーからの検索

Initial Tags
google, python, django

Initial Language
Python