mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fixes #1325: Retain interface attachment when editing a circuit termination
This commit is contained in:
@ -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'),
|
||||||
|
})
|
||||||
|
)
|
||||||
|
Reference in New Issue
Block a user