According to the docs: http://code.google.com/appengine/docs/python/datastore/datamodeling.html#References an
automatically created backlink object is a Query object, so iterating through it and making selection calls are possible.
But : I have one model:
class User(db.Model):
name = db.StringProperty()
...
and the second model:
class Thing(db.Model):
owner = db.ReferenceProperty(User)
...
And when I try to get the backlink:
for thing in user.thing_set:
...
or
user.thing_set.fetch(100)
I get an exception like this:
<type 'exceptions.TypeError'>: '_ReverseReferenceProperty' object is not iterable
or like this:
<type 'exceptions.AttributeError'>: '_ReverseReferenceProperty' object has no attribute 'fetch'
Am I doing something wrong or some changes in appengine? I'm pretty sure it used to work like Query. There is even an example on the docs page that shows the same thing as mine:
for obj in obj1.secondmodel_set:
Adding to a request without a backlink works fine:
things = Thing.all().filter('owner =', user)