First Model
class A(db.Model):
number = db.IntgerProperty()
second Model
class B(db.Model):
name = db.StringProperty()
numbers = db.ListProperty(db.Key)
A Model successfully saved.
a = A()
a.number = 90
a.put()
BadValueError: Items in the numbers list must all be Key instances
b = B()
b.name = 'test'
b.numbers = [90]
b.put()
Will you please help? thanks alot.
Edit (based on OP comment): If you want to insert a
db.Keyyou’ll need to provide one.Calling
put()returns a key, so you can use that, e.g.:Old answer before OP clarification:
With
db.ListProperty(db.Key)you’re saying you want a list ofdb.Keyinstances.If you want integers, declare your model like this: