class FirstModel(db.Model):
prop = db.IntegerProperty()
class SecondModel(db.Model):
reference = db.ReferenceProperty(FirstModel)
first1 = FirstModel(...).put()
first2 = FirstModel(...).put()
first3 = FirstModel(...).put()
fList = [first1,first2,first3]
sList = []
for i in range( 10 ):
sList.append( SecondModel( reference = fList[i%3] ).put() )
# now, i have 10 SecondModel references 3 FirstModel.
q = SecondModel.all()
secList = q.fetch( q.count() )
FirstSet = set( [s.reference for s in secList] )
print len( FirstSet )
# now, len( FirstSet ) should be 3, but there is 10.
it regards same FirstModel referenced by different SecondModel as
different. how to make it regards it same?
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.