Skip to content

Commit

Permalink
Fixes #3709: Prevent exception when importing an invalid cable defini…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
jeremystretch committed Nov 26, 2019
1 parent 6a451e0 commit 1d18948
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/release-notes/version-2.6.md
Expand Up @@ -12,6 +12,7 @@
* [#3669](https://github.com/netbox-community/netbox/issues/3669) - Include `weight` field in prefix/VLAN role form
* [#3674](https://github.com/netbox-community/netbox/issues/3674) - Include comments on PowerFeed view
* [#3679](https://github.com/netbox-community/netbox/issues/3679) - Fix link for assigned ipaddress in interface page
* [#3709](https://github.com/netbox-community/netbox/issues/3709) - Prevent exception when importing an invalid cable definition

# v2.6.7 (2019-11-01)

Expand Down
4 changes: 4 additions & 0 deletions netbox/dcim/models.py
Expand Up @@ -2838,6 +2838,8 @@ def get_absolute_url(self):
def clean(self):

# Validate that termination A exists
if not hasattr(self, 'termination_a_type'):
raise ValidationError('Termination A type has not been specified')
try:
self.termination_a_type.model_class().objects.get(pk=self.termination_a_id)
except ObjectDoesNotExist:
Expand All @@ -2846,6 +2848,8 @@ def clean(self):
})

# Validate that termination B exists
if not hasattr(self, 'termination_b_type'):
raise ValidationError('Termination B type has not been specified')
try:
self.termination_b_type.model_class().objects.get(pk=self.termination_b_id)
except ObjectDoesNotExist:
Expand Down

0 comments on commit 1d18948

Please sign in to comment.