diff --git a/ereuse_devicehub/migrations/versions/d7ea9a3b2da1_create_placeholders.py b/ereuse_devicehub/migrations/versions/d7ea9a3b2da1_create_placeholders.py index 6abff7a8..87a7154b 100644 --- a/ereuse_devicehub/migrations/versions/d7ea9a3b2da1_create_placeholders.py +++ b/ereuse_devicehub/migrations/versions/d7ea9a3b2da1_create_placeholders.py @@ -63,6 +63,9 @@ def clone_device(device): if device.type == "Battery": device.size + + old_devicehub_id = device.devicehub_id + dict_device = copy.copy(device.__dict__) dict_device.pop('_sa_instance_state') dict_device.pop('id', None) @@ -73,6 +76,8 @@ def clone_device(device): dict_device.pop('tags', None) dict_device.pop('system_uuid', None) new_device = device.__class__(**dict_device) + new_device.devicehub_id = old_devicehub_id + device.devicehub_id = None db.session.add(new_device) if hasattr(device, 'components'): diff --git a/ereuse_devicehub/resources/documents/device_row.py b/ereuse_devicehub/resources/documents/device_row.py index edca2752..b239ee92 100644 --- a/ereuse_devicehub/resources/documents/device_row.py +++ b/ereuse_devicehub/resources/documents/device_row.py @@ -276,7 +276,7 @@ class DeviceRow(BaseDeviceRow): software=snapshot.software.name, version=snapshot.version ) # General information about device - self['DHID'] = device.devicehub_id + self['DHID'] = self.placeholder.device.devicehub_id self['DocumentID'] = self.document_id self['Public Link'] = '{url}{id}'.format( url=url_for('Device.main', _external=True), id=device.devicehub_id diff --git a/ereuse_devicehub/templates/inventory/device_detail.html b/ereuse_devicehub/templates/inventory/device_detail.html index 9f46e787..ccc90020 100644 --- a/ereuse_devicehub/templates/inventory/device_detail.html +++ b/ereuse_devicehub/templates/inventory/device_detail.html @@ -34,7 +34,7 @@ {% if placeholder.binding %} {% endif %}