KindError: Property r must be an instance of SecondModel, why ?
- by zjm1126
class FirstModel(db.Model):
p = db.StringProperty()
r=db.ReferenceProperty(SecondModel)
class SecondModel(db.Model):
r = db.ReferenceProperty(FirstModel)
class sss(webapp.RequestHandler):
def get(self):
a=FirstModel()
a.p='sss'
a.put()
b=SecondModel()
b.r=a
b.put()
a.r=b
a.put()
self.response.out.write(str(b.r.p))
the error is :
Traceback (most recent call last):
File "D:\Program Files\Google\google_appengine\google\appengine\ext\webapp\__init__.py", line 511, in __call__
handler.get(*groups)
File "D:\zjm_code\helloworld\a.py", line 158, in get
a.r=b
File "D:\Program Files\Google\google_appengine\google\appengine\ext\db\__init__.py", line 3009, in __set__
value = self.validate(value)
File "D:\Program Files\Google\google_appengine\google\appengine\ext\db\__init__.py", line 3048, in validate
(self.name, self.reference_class.kind()))
KindError: Property r must be an instance of SecondModel
thanks