ndemir
ndemir

Reputation: 1911

SelfReferenceProperty question

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 to handle this with google appengine?

Upvotes: 2

Views: 325

Answers (1)

Drew Sears
Drew Sears

Reputation: 12838

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

Upvotes: 5

Related Questions