summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLingxian Kong <anlin.kong@gmail.com>2021-07-10 12:41:25 +1200
committerLingxian Kong <anlin.kong@gmail.com>2021-07-10 12:44:05 +1200
commit7b4631181752be749092add04d5f0ecd57057c73 (patch)
tree0b30f8cfb0726563ccb70f17ae97cead5956fa6c
parent190529506b8d7bd75c9079be0c55cf9e247299a3 (diff)
downloadtrove-7b4631181752be749092add04d5f0ecd57057c73.tar.gz
Show all the instances in descending order of creation time
This is for list instance response of admin user, keep consistent with the behavior of normal user. Change-Id: I0000b9b0139471064c9589fe5c350b6facdd80dd
-rw-r--r--trove/extensions/mgmt/instances/views.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/trove/extensions/mgmt/instances/views.py b/trove/extensions/mgmt/instances/views.py
index ae580963..9dbe7877 100644
--- a/trove/extensions/mgmt/instances/views.py
+++ b/trove/extensions/mgmt/instances/views.py
@@ -106,8 +106,9 @@ class MgmtInstancesView(object):
def data(self):
data = []
- # These are model instances
- for instance in self.instances:
+ # Return instances in the order of 'created'
+ for instance in sorted(self.instances, key=lambda ins: ins.created,
+ reverse=True):
data.append(self.data_for_instance(instance))
return {'instances': data}