Skip to content

Commit 8539686

Browse files
committed
Fixes #17601: Record change to terminating object when disconnecting a cable
1 parent 50df0a1 commit 8539686

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

netbox/dcim/models/cables.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,11 +366,11 @@ def save(self, *args, **kwargs):
366366
def delete(self, *args, **kwargs):
367367

368368
# Delete the cable association on the terminating object
369-
termination_model = self.termination._meta.model
370-
termination_model.objects.filter(pk=self.termination_id).update(
371-
cable=None,
372-
cable_end=''
373-
)
369+
termination = self.termination._meta.model.objects.get(pk=self.termination_id)
370+
termination.snapshot()
371+
termination.cable = None
372+
termination.cable_end = ''
373+
termination.save()
374374

375375
super().delete(*args, **kwargs)
376376

0 commit comments

Comments
 (0)