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)