I have objects Exhibitthat reference objects Gallery, both of which are stored in the Google App Engine datastore.
How to arrange a collection Exhibitfor each object Gallerywhen I get around to iterating over values (ultimately in a Django template)?
i.e. this does not work
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')
When rendering in the template, the galleries are correctly ordered, but the exhibits are not.
source
share