From 967319f50ca00637d484e7430e896958d65e48f7 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 9 Aug 2022 12:17:18 +0200 Subject: [PATCH] fix binding confirm --- ereuse_devicehub/inventory/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ereuse_devicehub/inventory/views.py b/ereuse_devicehub/inventory/views.py index 6239d98c..8c841a1e 100644 --- a/ereuse_devicehub/inventory/views.py +++ b/ereuse_devicehub/inventory/views.py @@ -198,6 +198,7 @@ class BindingView(GenericMixin): if device.placeholder: device = device.placeholder.binding + dhid = device.devicehub_id if request.method == 'POST': old_placeholder = device.binding @@ -216,10 +217,11 @@ class BindingView(GenericMixin): if act.device == old_device_placeholder: db.session.delete(act) - db.session.delete(old_device_placeholder) for tag in list(old_device_placeholder.tags): tag.device = placeholder.device + db.session.delete(old_device_placeholder) + device.binding = placeholder db.session.commit() next_url = url_for('inventory.device_details', id=dhid)