How can I check if query is sorted?
class Thing(ndb.Model): pass
query = Thing.query().sort(Thing.id)
How can I reverse such sort?
query.orders
will return a datastore_query.Order
, which has a reversed
method, so something like:
query = Thing.query().order(Thing.id)
[...]
order = query.orders
reversed_order = order.reversed()
new_query = Thing.query().order(reversed_order)
If there isn't an order on the query, order
will be None
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.