1
下面這組查詢連接了一系列配置文件,並返回到網站。訂購查詢
我想用這些做一個查詢,因爲我想在整個配置集合上使用order函數。
# Get all users for who 'currentUser' is an assistant for.
users = Users.query(Users.assistant.IN(currentUser)).fetch()
# Get all profiles that belong to those users and have not been deleted.
for user in users:
profiles = profiles + Profiles.query(
ndb.AND(
Profiles.user == user.username,
Profiles.deleted == False
)
).order(Profiles.history).fetch() # Order all profiles by timestamp
工作就像一個魅力,謝謝你! –