mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-09 00:58:16 -06:00
Fixes #3310: preselect site and rack when connecting cable
This commit is contained in:
parent
b7e78028ce
commit
d0ec51eff0
@ -9,6 +9,7 @@
|
||||
* [#3009](https://github.com/netbox-community/netbox/issues/3009) - Search by description when assigning IP address
|
||||
* [#3090](https://github.com/netbox-community/netbox/issues/3090) - Add filter field for device interfaces
|
||||
* [#3187](https://github.com/netbox-community/netbox/issues/3187) - Add rack selection field to rack elevations
|
||||
* [#3310](https://github.com/netbox-community/netbox/issues/3310) - Preselect site and rack when connecting cable
|
||||
* [#3393](https://github.com/netbox-community/netbox/issues/3393) - Paginate the circuits at the provider details view
|
||||
* [#3440](https://github.com/netbox-community/netbox/issues/3440) - Add total length to cable trace
|
||||
* [#3623](https://github.com/netbox-community/netbox/issues/3623) - Add word expansion during interface creation
|
||||
|
@ -2726,6 +2726,18 @@ class ConnectCableToDeviceForm(BootstrapMixin, ChainedFieldsMixin, forms.ModelFo
|
||||
'label', 'color', 'length', 'length_unit',
|
||||
]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
# Initialize site and rack fields to match that of the existing temination
|
||||
if self.instance and self.instance.termination_a:
|
||||
termination_a_parent = self.instance.termination_a.parent
|
||||
if hasattr(termination_a_parent, 'site'):
|
||||
self.initial['termination_b_site'] = termination_a_parent.site
|
||||
if hasattr(termination_a_parent, 'rack'):
|
||||
self.initial['termination_b_rack'] = termination_a_parent.rack
|
||||
|
||||
|
||||
class ConnectCableToConsolePortForm(ConnectCableToDeviceForm):
|
||||
termination_b_id = forms.IntegerField(
|
||||
|
Loading…
Reference in New Issue
Block a user