In the code below, I'm inserting one piece of data, and then a second one assigning the first as the parent. Both pieces of data go in, but no parent relationship is created. What am I doing wrong?
from google.appengine.ext import db
class Test_Model(db.Model):
"""Just a model for testing."""
name = db.StringProperty()
# Create parent data
test_data_1 = Test_Model()
test_data_1.name = "Test Data 1"
put_result_1 = test_data_1.put()
# Create child data
test_data_2 = Test_Model()
test_data_2.name = "Test Data 2"
# Here's where I assign the parent to the child
test_data_2.parent = put_result_1
put_result = test_data_2.put()
query = Test_Model.all()
results = query.fetch(100)
for result in results:
print "Name: " + result.name
print result.parent()