mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 09:51:22 -06:00
Fixes #2566: Prevent both ends of a cable from connecting to the same termination point
This commit is contained in:
parent
0dee55885b
commit
4b5181d640
@ -40,6 +40,7 @@ NetBox now supports modeling physical cables for console, power, and interface c
|
|||||||
## Bug Fixes (from v2.5-beta1)
|
## Bug Fixes (from v2.5-beta1)
|
||||||
|
|
||||||
* [#2563](https://github.com/digitalocean/netbox/issues/2563) - Enable export templates for cables
|
* [#2563](https://github.com/digitalocean/netbox/issues/2563) - Enable export templates for cables
|
||||||
|
* [#2566](https://github.com/digitalocean/netbox/issues/2566) - Prevent both ends of a cable from connecting to the same termination point
|
||||||
* [#2567](https://github.com/digitalocean/netbox/issues/2567) - Introduced proxy models to represent console/power/interface connections
|
* [#2567](https://github.com/digitalocean/netbox/issues/2567) - Introduced proxy models to represent console/power/interface connections
|
||||||
|
|
||||||
## API Changes
|
## API Changes
|
||||||
|
@ -2516,6 +2516,11 @@ class Cable(ChangeLoggedModel):
|
|||||||
self.termination_a_type, self.termination_b_type
|
self.termination_a_type, self.termination_b_type
|
||||||
))
|
))
|
||||||
|
|
||||||
|
# A termination point cannot be connected to itself
|
||||||
|
if self.termination_a == self.termination_b:
|
||||||
|
print("Validation failed: same interface")
|
||||||
|
raise ValidationError("Cannot connect {} to itself".format(self.termination_a_type))
|
||||||
|
|
||||||
# Check for an existing Cable connected to either termination object
|
# Check for an existing Cable connected to either termination object
|
||||||
if self.termination_a.cable not in (None, self):
|
if self.termination_a.cable not in (None, self):
|
||||||
raise ValidationError("{} already has a cable attached (#{})".format(
|
raise ValidationError("{} already has a cable attached (#{})".format(
|
||||||
|
@ -42,7 +42,6 @@ $(document).ready(function() {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
search_field.val(ui.item.label);
|
search_field.val(ui.item.label);
|
||||||
select_fields.val('');
|
select_fields.val('');
|
||||||
select_fields.attr('disabled', 'disabled');
|
|
||||||
real_field.empty();
|
real_field.empty();
|
||||||
real_field.append($("<option></option>").attr('value', ui.item.value).text(ui.item.label));
|
real_field.append($("<option></option>").attr('value', ui.item.value).text(ui.item.label));
|
||||||
real_field.change();
|
real_field.change();
|
||||||
|
Loading…
Reference in New Issue
Block a user