class Profile(db.Model):
user = db.UserProperty()
class Playlist(db.Model):
name = db.StringProperty()
profile = db.ReferenceProperty(Profile, collection_name='playlists')
videos_num = db.IntegerProperty(default=0)
这是我的模型的基本实体。我可以访问 profile.playlists
之类的播放列表,但如何根据其 video_num 对它们进行排序?
最佳答案
profile.playlists
只是一个 db.Query。调用其 .order('videos_num')
方法。
关于python - 在 appengine 中对 collection_name 进行排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6162298/