소스 검색

Fixes #17601: Record change to terminating object when disconnecting a cable

Jeremy Stretch 1 년 전
부모
커밋
85396866bc
1개의 변경된 파일5개의 추가작업 그리고 5개의 파일을 삭제
  1. 5 5
      netbox/dcim/models/cables.py

+ 5 - 5
netbox/dcim/models/cables.py

@@ -366,11 +366,11 @@ class CableTermination(ChangeLoggedModel):
     def delete(self, *args, **kwargs):
 
         # Delete the cable association on the terminating object
-        termination_model = self.termination._meta.model
-        termination_model.objects.filter(pk=self.termination_id).update(
-            cable=None,
-            cable_end=''
-        )
+        termination = self.termination._meta.model.objects.get(pk=self.termination_id)
+        termination.snapshot()
+        termination.cable = None
+        termination.cable_end = ''
+        termination.save()
 
         super().delete(*args, **kwargs)