From 67cf797c6ce81d30668b7bea07e05aac516c6fc4 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 22 Nov 2022 11:58:56 +0100 Subject: [PATCH 1/3] fixing name hardDrive in filter --- ereuse_devicehub/inventory/forms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ereuse_devicehub/inventory/forms.py b/ereuse_devicehub/inventory/forms.py index 41505a8a..b86dca83 100644 --- a/ereuse_devicehub/inventory/forms.py +++ b/ereuse_devicehub/inventory/forms.py @@ -88,7 +88,7 @@ DEVICES = { ], "Drives & Storage": [ "All DataStorage", - "HardDrives", + "HardDrive", "SolidStageDrive", ], } From 7bf879bbcf608889095560df7f9eb462ac1f849f Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 22 Nov 2022 11:59:31 +0100 Subject: [PATCH 2/3] add my_partner for get the partner of one device --- ereuse_devicehub/resources/device/models.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ereuse_devicehub/resources/device/models.py b/ereuse_devicehub/resources/device/models.py index 0f398737..35e4d559 100644 --- a/ereuse_devicehub/resources/device/models.py +++ b/ereuse_devicehub/resources/device/models.py @@ -632,6 +632,14 @@ class Device(Thing): return self.binding.device.devicehub_id return self.devicehub_id + @property + def my_partner(self): + if self.placeholder and self.placeholder.binding: + return self.placeholder.binding + if self.binding: + return self.binding.device + return self + @property def get_updated(self): if self.placeholder and self.placeholder.binding: From 796f49f6cf17282ed71a93fa94ef61a8ec986509 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 22 Nov 2022 12:00:17 +0100 Subject: [PATCH 3/3] show correctly the ids in the templates --- ereuse_devicehub/templates/inventory/erasure_list.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ereuse_devicehub/templates/inventory/erasure_list.html b/ereuse_devicehub/templates/inventory/erasure_list.html index adaec94f..7573bb4b 100644 --- a/ereuse_devicehub/templates/inventory/erasure_list.html +++ b/ereuse_devicehub/templates/inventory/erasure_list.html @@ -128,7 +128,7 @@ {% for ac in erasure %} - 0 %} + {% if ac.device.my_partner.lots | length > 0 %}
- {% for lot in ac.device.get_lots_for_template() %} + {% for lot in ac.device.my_partner.get_lots_for_template() %} {{ lot }} {% endfor %}