मैंने this question पढ़ा है और सरल और स्पष्ट उत्तर है लेकिन यह मेरे मामले में उपयोगी नहीं है क्योंकि उत्तर नेस्टेड for
पर विचार नहीं किया जाता है। कृपया, कोड देखें:एनडीबी में बैक-रेफरेंस प्रॉपर्टी का विकल्प क्या है?
class SuperCat(ndb.Model):
class Category(ndb.Model):
supercat = ndb.KeyProperty(kind=SuperCat)
class SubCat(ndb.Model):
category = ndb.KeyProperty(kind=Category)
हैंडलर:
Categories = ndb.gql("SELECT * FROM Category WHERE supercat = :1", supercat_key)
self.generate('supercat.html', {'Categories': Categories})
टेम्पलेट में
, पुराने db.Model और बैक-संदर्भ संपत्ति के साथ इस पर्याप्त है:
{{ for Category in Categories }}
{{ for SubCat in Category.subcat_set }} # this is the back-reference in action
क्या है ऐसी डेटा संरचना की सेवा के लिए समान रूप से सरल विकल्प?
ऐसा लगता है कि [संरचित गुण] (https://developers.google.com/appengine/docs/python/ndb/properties#structured) एक अच्छी शुरुआत बिंदु है .. –