From 5932213764338402851cb799091b9710feb08cb5 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 8 Jun 2022 09:26:09 +0200 Subject: [PATCH] save sid in html label --- ereuse_devicehub/resources/device/models.py | 6 ++++++ ereuse_devicehub/templates/labels/print_labels.html | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ereuse_devicehub/resources/device/models.py b/ereuse_devicehub/resources/device/models.py index 18487ba5..8b2fb93b 100644 --- a/ereuse_devicehub/resources/device/models.py +++ b/ereuse_devicehub/resources/device/models.py @@ -401,6 +401,12 @@ class Device(Thing): return history + @property + def sid(self): + actions = [x for x in self.actions if x.t == 'Snapshot' and x.sid] + if actions: + return actions[0] + @property def tradings(self): return {str(x.id): self.trading(x.lot) for x in self.actions if x.t == 'Trade'} diff --git a/ereuse_devicehub/templates/labels/print_labels.html b/ereuse_devicehub/templates/labels/print_labels.html index 3c9ffaae..07b8c113 100644 --- a/ereuse_devicehub/templates/labels/print_labels.html +++ b/ereuse_devicehub/templates/labels/print_labels.html @@ -35,7 +35,8 @@
{{ dev.devicehub_id }} + data-model="{{ dev.model or '' }}" + data-sid="{{ dev.sid or '' }}">{{ dev.devicehub_id }}
@@ -103,6 +104,10 @@ +
+ + +