I have Exhibit
objects which reference Gallery
objects both of which are stored in the Google App Engine Datastore.
How do I order the Exhibit
collection on each Gallery
object when I get around to iterating over the 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')
# ... send galleries off the the Django template
When rendered in the template, the galleries are correctly ordered but the exhibits are not.