From d25c9faf253c0aa4b20074e7d6538a311260c449 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 3 Mar 2022 10:43:34 +0100 Subject: [PATCH] fix change #2825, tags only for Computers --- ereuse_devicehub/resources/device/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ereuse_devicehub/resources/device/models.py b/ereuse_devicehub/resources/device/models.py index a97c7392..7c230f57 100644 --- a/ereuse_devicehub/resources/device/models.py +++ b/ereuse_devicehub/resources/device/models.py @@ -1206,8 +1206,9 @@ def create_code_tag(mapper, connection, device): this tag is the same of devicehub_id. """ from ereuse_devicehub.resources.tag.model import Tag - tag = Tag(device_id=device.id, id=device.devicehub_id) - db.session.add(tag) + if isinstance(device, Computer): + tag = Tag(device_id=device.id, id=device.devicehub_id) + db.session.add(tag) event.listen(Device, 'after_insert', create_code_tag, propagate=True)