實體的字符串編碼的關鍵爲了得到一個實體的字符串編碼的關鍵,我只是做到以下幾點:獲得從引用屬性中的AppEngine
key = entity.key()
string_encoded_key = str(key)
我有另一個參考實體通過ReferenceProperty。
class ParentClass(db.Model):
name = db.StringProperty()
class ChildClass(db.Model):
name = db.StringProperty()
bio_parent = db.ReferenceProperty(ParentClass)
johnnys_parent = ParentClass(name="John").put()
child = ChildClass(name="Johnny",bio_parent=johnnys_parent).put()
#getting the string-encoded key of the parent through the child
child = ChildClass.all().filter("name","Johnny").get()
string_encoded_key = str(child.bio_parent) # <--- this doesn't give me the string-encoded key
如何通過子實體獲取生物父母的字符串編碼密鑰而無需獲取父實體?
謝謝!
我認爲我的答案會幫助你..其他嘗試更具體 – 2011-03-16 11:17:10