To get the string code of an object, I just do the following:
key = entity.key()
string_encoded_key = str(key)
I have a reference to another object via 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()
child = ChildClass.all().filter("name","Johnny").get()
string_encoded_key = str(child.bio_parent)
How to get a string encoded biological parent key through a child without retrieving the parent?
Thank!
source
share