特定のランキングアルゴリズムに基づいた「ホット」ストーリーのフロントページを実装しています。ただし、App Engineデータストアに独自の並べ替え関数を渡す方法がわかりません(Pythonでsort(key = running_function)を使用して渡すことができます)。私はこのようなものが欲しい:
class Story(db.Model):
user = db.ReferenceProperty(User)
text = db.TextProperty()
def ranking(self):
# my ranking function, returns an int or something
return 1
ranking = property(ranking_function)
後で電話できるように:
Story.all().order("ranking").limit(50)
App Engineデータストアモデルを使用してこれを行う方法はありますか?