소스 검색

Closes #17832: Don't validate terminations on Cable instance when importing from serialzied data

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

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

@@ -164,7 +164,7 @@ class Cable(PrimaryModel):
         if self.length is not None and not self.length_unit:
             raise ValidationError(_("Must specify a unit when setting a cable length"))
 
-        if self._state.adding and (not self.a_terminations or not self.b_terminations):
+        if self._state.adding and self.pk is None and (not self.a_terminations or not self.b_terminations):
             raise ValidationError(_("Must define A and B terminations when creating a new cable."))
 
         if self._terminations_modified: