fix binding confirm

This commit is contained in:
Cayo Puigdefabregas 2022-08-09 12:17:18 +02:00
parent 00f03cb082
commit 967319f50c

View file

@ -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)