فهرست منبع

Fix terminations assignment

jeremystretch 3 سال پیش
والد
کامیت
ecee7421ea
1فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 3 3
      netbox/dcim/models/cables.py

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

@@ -92,8 +92,6 @@ class Cable(NetBoxModel):
         null=True
         null=True
     )
     )
 
 
-    terminations = []
-
     class Meta:
     class Meta:
         ordering = ('pk',)
         ordering = ('pk',)
 
 
@@ -112,7 +110,9 @@ class Cable(NetBoxModel):
             assert self.pk is None
             assert self.pk is None
             for t in terminations:
             for t in terminations:
                 t.cable = self
                 t.cable = self
-                self.terminations.append(t)
+            self.terminations = terminations
+        else:
+            self.terminations = []
 
 
     @classmethod
     @classmethod
     def from_db(cls, db, field_names, values):
     def from_db(cls, db, field_names, values):