Skip to content

Commit b61289d

Browse files
committed
updated segment type specific model - fiber type as a multichoice, conector type side specific
1 parent 78feb5b commit b61289d

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

cesnet_service_path_plugin/forms/segment.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,15 @@ def add_type_specific_fields(self):
144144
help_text=field_config.get("help_text", ""),
145145
widget=forms.Select(attrs={"class": "form-select", "data-type-field": segment_type}),
146146
)
147+
elif field_config["type"] == "multichoice":
148+
choices = [(c, c) for c in field_config.get("choices", [])]
149+
field = forms.MultipleChoiceField(
150+
label=field_config["label"],
151+
required=False,
152+
choices=choices,
153+
help_text=field_config.get("help_text", ""),
154+
widget=forms.SelectMultiple(attrs={"class": "form-select", "data-type-field": segment_type}),
155+
)
147156
else: # string
148157
field = forms.CharField(
149158
label=field_config["label"],

cesnet_service_path_plugin/models/segment_types.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class SegmentTypeChoices(ChoiceSet):
2323
SEGMENT_TYPE_SCHEMAS = {
2424
SegmentTypeChoices.DARK_FIBER: {
2525
"fiber_type": {
26-
"type": "choice",
26+
"type": "multichoice",
2727
"label": "Fiber Type",
2828
"choices": ["G.652D", "G.655", "G.657A1", "G.657A2", "G.652B", "G.652C", "G.653", "G.654E"],
2929
"required": False,
@@ -67,9 +67,16 @@ class SegmentTypeChoices(ChoiceSet):
6767
"required": False,
6868
"help_text": "Total number of fiber strands in the cable",
6969
},
70-
"connector_type": {
70+
"connector_type_side_a": {
71+
"type": "choice",
72+
"label": "Connector Type Side A",
73+
"choices": ["LC/APC", "LC/UPC", "SC/APC", "SC/UPC", "FC/APC", "FC/UPC", "ST/UPC", "E2000/APC", "MTP/MPO"],
74+
"required": False,
75+
"help_text": "Optical connector type and polish",
76+
},
77+
"connector_type_side_b": {
7178
"type": "choice",
72-
"label": "Connector Type",
79+
"label": "Connector Type Side B",
7380
"choices": ["LC/APC", "LC/UPC", "SC/APC", "SC/UPC", "FC/APC", "FC/UPC", "ST/UPC", "E2000/APC", "MTP/MPO"],
7481
"required": False,
7582
"help_text": "Optical connector type and polish",

0 commit comments

Comments
 (0)