From a2626a0b587ddfe7cba2ae5b9c3a271f6ac67c4d Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 30 Nov 2022 16:46:10 +0100 Subject: [PATCH] add settings version to version column in snapshots log --- ereuse_devicehub/parser/models.py | 8 ++++++++ ereuse_devicehub/templates/inventory/snapshots_list.html | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ereuse_devicehub/parser/models.py b/ereuse_devicehub/parser/models.py index 6d8cdb4e..38ddbaf7 100644 --- a/ereuse_devicehub/parser/models.py +++ b/ereuse_devicehub/parser/models.py @@ -84,6 +84,14 @@ class SnapshotsLog(Thing): except AttributeError: return '' + def get_version(self): + if not self.snapshot: + return self.version + settings_version = self.snapshot.settings_version or '' + settings_version = "".join([x[0] for x in settings_version.split(' ') if x]) + + return "{} ({})".format(self.version, settings_version) + class PlaceholdersLog(Thing): """A Placeholder log.""" diff --git a/ereuse_devicehub/templates/inventory/snapshots_list.html b/ereuse_devicehub/templates/inventory/snapshots_list.html index ffe4a898..126d3ac3 100644 --- a/ereuse_devicehub/templates/inventory/snapshots_list.html +++ b/ereuse_devicehub/templates/inventory/snapshots_list.html @@ -87,7 +87,7 @@ {% endif %} - {{ snap.version }} + {{ snap.get_version() }} {% if snap.get_device() %}