mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fixes #1927: Include all VC member interaces on A side when creating a new interface connection
This commit is contained in:
@ -2069,7 +2069,7 @@ class InterfaceConnectionForm(BootstrapMixin, ChainedFieldsMixin, forms.ModelFor
|
|||||||
super(InterfaceConnectionForm, self).__init__(*args, **kwargs)
|
super(InterfaceConnectionForm, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
# Initialize interface A choices
|
# Initialize interface A choices
|
||||||
device_a_interfaces = Interface.objects.connectable().order_naturally().filter(device=device_a).select_related(
|
device_a_interfaces = device_a.vc_interfaces.connectable().order_naturally().select_related(
|
||||||
'circuit_termination', 'connected_as_a', 'connected_as_b'
|
'circuit_termination', 'connected_as_a', 'connected_as_b'
|
||||||
)
|
)
|
||||||
self.fields['interface_a'].choices = [
|
self.fields['interface_a'].choices = [
|
||||||
@ -2078,9 +2078,11 @@ class InterfaceConnectionForm(BootstrapMixin, ChainedFieldsMixin, forms.ModelFor
|
|||||||
|
|
||||||
# Mark connected interfaces as disabled
|
# Mark connected interfaces as disabled
|
||||||
if self.data.get('device_b'):
|
if self.data.get('device_b'):
|
||||||
self.fields['interface_b'].choices = [
|
self.fields['interface_b'].choices = []
|
||||||
(iface.id, {'label': iface.name, 'disabled': iface.is_connected}) for iface in self.fields['interface_b'].queryset
|
for iface in self.fields['interface_b'].queryset:
|
||||||
]
|
self.fields['interface_b'].choices.append(
|
||||||
|
(iface.id, {'label': iface.name, 'disabled': iface.is_connected})
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class InterfaceConnectionCSVForm(forms.ModelForm):
|
class InterfaceConnectionCSVForm(forms.ModelForm):
|
||||||
|
Reference in New Issue
Block a user