Skip to content

Commit 4242546

Browse files
committed
Fixes netbox-community#16376: Log changes on terminating objects when attaching a cable
1 parent 87109f5 commit 4242546

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
@@ -355,11 +355,11 @@ def save(self, *args, **kwargs):
355355
super().save(*args, **kwargs)
356356

357357
# Set the cable on the terminating object
358-
termination_model = self.termination._meta.model
359-
termination_model.objects.filter(pk=self.termination_id).update(
360-
cable=self.cable,
361-
cable_end=self.cable_end
362-
)
358+
termination = self.termination._meta.model.objects.get(pk=self.termination_id)
359+
termination.snapshot()
360+
termination.cable = self.cable
361+
termination.cable_end = self.cable_end
362+
termination.save()
363363

364364
def delete(self, *args, **kwargs):
365365

0 commit comments

Comments
 (0)