Skip to content

Commit

Permalink
16176 Add UI for multi-termination cables
Browse files Browse the repository at this point in the history
  • Loading branch information
arthanson authored and jeremystretch committed Aug 10, 2024
1 parent b7b0ab1 commit f6c1642
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions netbox/dcim/forms/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __new__(mcs, name, bases, attrs):
# Device component
if hasattr(term_cls, 'device'):

attrs[f'termination_{cable_end}_device'] = DynamicModelChoiceField(
attrs[f'termination_{cable_end}_device'] = DynamicModelMultipleChoiceField(
queryset=Device.objects.all(),
label=_('Device'),
required=False,
Expand All @@ -33,6 +33,7 @@ def __new__(mcs, name, bases, attrs):
label=term_cls._meta.verbose_name.title(),
context={
'disabled': '_occupied',
'parent': 'device',
},
query_params={
'device_id': f'$termination_{cable_end}_device',
Expand All @@ -43,7 +44,7 @@ def __new__(mcs, name, bases, attrs):
# PowerFeed
elif term_cls == PowerFeed:

attrs[f'termination_{cable_end}_powerpanel'] = DynamicModelChoiceField(
attrs[f'termination_{cable_end}_powerpanel'] = DynamicModelMultipleChoiceField(
queryset=PowerPanel.objects.all(),
label=_('Power Panel'),
required=False,
Expand All @@ -57,6 +58,7 @@ def __new__(mcs, name, bases, attrs):
label=_('Power Feed'),
context={
'disabled': '_occupied',
'parent': 'powerpanel',
},
query_params={
'power_panel_id': f'$termination_{cable_end}_powerpanel',
Expand All @@ -66,7 +68,7 @@ def __new__(mcs, name, bases, attrs):
# CircuitTermination
elif term_cls == CircuitTermination:

attrs[f'termination_{cable_end}_circuit'] = DynamicModelChoiceField(
attrs[f'termination_{cable_end}_circuit'] = DynamicModelMultipleChoiceField(
queryset=Circuit.objects.all(),
label=_('Circuit'),
selector=True,
Expand All @@ -79,6 +81,7 @@ def __new__(mcs, name, bases, attrs):
label=_('Side'),
context={
'disabled': '_occupied',
'parent': 'circuit',
},
query_params={
'circuit_id': f'$termination_{cable_end}_circuit',
Expand Down

0 comments on commit f6c1642

Please sign in to comment.