mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-23 07:56:44 -06:00
14033 raise validation error if A and B term go to same object
This commit is contained in:
parent
14447befb9
commit
77d205d65f
@ -103,4 +103,10 @@ def get_cable_form(a_type, b_type):
|
||||
self.instance.a_terminations = self.cleaned_data['a_terminations']
|
||||
self.instance.b_terminations = self.cleaned_data['b_terminations']
|
||||
|
||||
if a_type == b_type and self.instance.a_terminations and self.instance.b_terminations:
|
||||
if self.instance.a_terminations.intersection(self.instance.b_terminations):
|
||||
raise forms.ValidationError(
|
||||
_("A and B terminations cannot connect to the same object.")
|
||||
)
|
||||
|
||||
return _CableForm
|
||||
|
Loading…
Reference in New Issue
Block a user