Return instances by created order

Change-Id: I558c36b4f0894f8476ce7fc9c88c1829e8762011
This commit is contained in:
Lingxian Kong 2020-10-29 12:09:14 +13:00
parent d21d37d628
commit 69c8467854

View File

@ -187,8 +187,11 @@ class InstancesView(object):
def data(self):
data = []
# Return instances in the order of 'created'
# These are model instances
for instance in self.instances:
for instance in sorted(self.instances, key=lambda ins: ins.created,
reverse=True):
data.append(self.data_for_instance(instance))
return {'instances': data}