From 8149d0ed7c310fb4804b0683dce71f9d5e7f8735 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 2 Feb 2022 13:27:53 +0100 Subject: [PATCH] reversed actions for see the better the traceability log --- ereuse_devicehub/resources/device/models.py | 4 ++++ ereuse_devicehub/templates/inventory/device_detail.html | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ereuse_devicehub/resources/device/models.py b/ereuse_devicehub/resources/device/models.py index a97c7392..16b9df5b 100644 --- a/ereuse_devicehub/resources/device/models.py +++ b/ereuse_devicehub/resources/device/models.py @@ -164,6 +164,10 @@ class Device(Thing): super().__init__(**kw) self.set_hid() + @property + def reverse_actions(self) -> list: + return reversed(self.actions) + @property def actions(self) -> list: """All the actions where the device participated, including: diff --git a/ereuse_devicehub/templates/inventory/device_detail.html b/ereuse_devicehub/templates/inventory/device_detail.html index 4f281921..5112efb9 100644 --- a/ereuse_devicehub/templates/inventory/device_detail.html +++ b/ereuse_devicehub/templates/inventory/device_detail.html @@ -109,7 +109,7 @@
Traceability log Details
- {% for action in device.actions %} + {% for action in device.reverse_actions %}
{{ action.type }} {{ action.severity }} {{ action.created.strftime('%H:%M %d-%m-%Y') }}