mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 04:22:01 -06:00
Fixes #1325: Retain interface attachment when editing a circuit termination
This commit is contained in:
parent
b253c8cc95
commit
bfd7881b7b
@ -252,6 +252,11 @@ class CircuitTerminationForm(BootstrapMixin, ChainedFieldsMixin, forms.ModelForm
|
|||||||
super(CircuitTerminationForm, self).__init__(*args, **kwargs)
|
super(CircuitTerminationForm, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
# Mark connected interfaces as disabled
|
# Mark connected interfaces as disabled
|
||||||
self.fields['interface'].choices = [
|
self.fields['interface'].choices = []
|
||||||
(iface.id, {'label': iface.name, 'disabled': iface.is_connected}) for iface in self.fields['interface'].queryset
|
for iface in self.fields['interface'].queryset:
|
||||||
]
|
self.fields['interface'].choices.append(
|
||||||
|
(iface.id, {
|
||||||
|
'label': iface.name,
|
||||||
|
'disabled': iface.is_connected and iface.pk != self.initial.get('interface'),
|
||||||
|
})
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user