【发布时间】:2009-03-27 19:40:03
【问题描述】:
我有引用 Gallery 对象的 Exhibit 对象,这两个对象都存储在 Google App Engine 数据存储区中。
当我开始迭代值时(最终在 Django 模板中),如何在每个 Gallery 对象上订购 Exhibit 集合?
即这不起作用
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
在模板中呈现时,画廊的顺序正确,但展品的顺序不正确。
【问题讨论】:
标签: python google-app-engine google-cloud-datastore