I have read this question and the simple and clear answer but it's not useful in my case because the answer don't consider the nested for
. please, see the code:
class SuperCat(ndb.Model):
class Category(ndb.Model):
supercat = ndb.KeyProperty(kind=SuperCat)
class SubCat(ndb.Model):
category = ndb.KeyProperty(kind=Category)
handler:
Categories = ndb.gql("SELECT * FROM Category WHERE supercat = :1", supercat_key)
self.generate('supercat.html', {'Categories': Categories})
in template, with the old db.Model and the back-reference property this is enough:
{{ for Category in Categories }}
{{ for SubCat in Category.subcat_set }} # this is the back-reference in action
What is the equally simple alternative to serve such data structure?