开发者

SelfReferenceProperty question

开发者 https://www.devze.com 2023-01-12 05:17 出处:网络
I am trying to use google appengine. I have this model: def Human(db.Model): name = db.StringProperty()

I am trying to use google appengine. I have this model:

def Human(db.Model):
 name = db.StringProperty()
 friends = db.SelfReferenceProperty()

This Human has more than one friend. So, how开发者_JAVA百科 to handle this with google appengine?


For simple many-to-many relationships, use a ListProperty with a list of keys.

If you need to store additional metadata, give the model its own relationship, e.g. Friendship.

Examples of both can be found @ http://code.google.com/appengine/articles/modeling.html

0

精彩评论

暂无评论...
验证码 换一张
取 消