make history api return things in most-recent-message-first.

This commit is contained in:
David Ascher 2010-09-08 10:20:09 -07:00
Родитель c42279960b
Коммит 13a65267c2
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -19,7 +19,11 @@ class HistoryController(BaseController):
def get(self):
userkey = session['userkey']
stmt = Session.query(Account.id).filter(Account.userkey==userkey).subquery()
data = Session.query(History, Account.domain, Account.username).filter(Account.id == History.account_id).filter(History.account_id.in_(stmt)).all()
data = Session.query(History, Account.domain, Account.username).filter(
Account.id == History.account_id).\
filter(History.account_id.in_(stmt)).\
order_by(History.published.desc()).\
all()
res = []
for h, d, u in data:
r = h.to_dict()