オブジェクトをExhibit
参照Gallery
するオブジェクトがあり、どちらも Google App Engine データストアに保存されています。
(最終的には Django テンプレートで) 値を繰り返し処理するときにExhibit
、各オブジェクトのコレクションをどのように並べ替えるのですか?Gallery
つまり、これは機能しません
class Gallery(db.Model):
title = db.StringProperty()
position = db.IntegerProperty()
class Exhibit(db.Model):
gallery = db.ReferenceProperty(Gallery, collection_name='exhibits')
title = db.StringProperty()
position = db.IntegerProperty()
galleries = db.GqlQuery('SELECT * FROM Gallery ORDER BY position')
for gallery in galleries:
gallery.exhibits.order('position')
# ... send galleries off the the Django template
テンプレートでレンダリングすると、ギャラリーは正しく並べられますが、展示は正しくありません。