2222from utilities .forms .widgets .datetime import DatePicker
2323
2424from cesnet_service_path_plugin .models import Segment
25- from cesnet_service_path_plugin .models .custom_choices import StatusChoices
25+ from cesnet_service_path_plugin .models .custom_choices import StatusChoices , OwnershipTypeChoices
2626from cesnet_service_path_plugin .models .segment_types import (
2727 SEGMENT_TYPE_SCHEMAS ,
2828 SegmentTypeChoices ,
3838class SegmentForm (NetBoxModelForm ):
3939 comments = CommentField (required = False , label = "Comments" , help_text = "Comments" )
4040 status = forms .ChoiceField (required = True , choices = StatusChoices , initial = None )
41+ ownership_type = forms .ChoiceField (required = True , choices = OwnershipTypeChoices , initial = None )
4142 provider_segment_id = forms .CharField (label = " ID" , required = False , help_text = "Provider Segment ID" )
4243 provider = DynamicModelChoiceField (
4344 queryset = Provider .objects .all (),
@@ -369,6 +370,7 @@ class Meta:
369370 "name" ,
370371 "segment_type" ,
371372 "status" ,
373+ "ownership_type" ,
372374 "network_label" ,
373375 "install_date" ,
374376 "termination_date" ,
@@ -390,6 +392,7 @@ class Meta:
390392 "segment_type" ,
391393 "network_label" ,
392394 "status" ,
395+ "ownership_type" ,
393396 InlineFields ("install_date" , "termination_date" , label = "Dates" ),
394397 name = "Basic Information" ,
395398 ),
@@ -432,6 +435,7 @@ class SegmentFilterForm(NetBoxModelFilterSetForm):
432435
433436 name = forms .CharField (required = False )
434437 status = forms .MultipleChoiceField (required = False , choices = StatusChoices , initial = None )
438+ ownership_type = forms .MultipleChoiceField (required = False , choices = OwnershipTypeChoices , initial = None )
435439 network_label = forms .CharField (required = False )
436440
437441 # Basic segment type filter
@@ -739,6 +743,12 @@ class SegmentBulkEditForm(NetBoxModelBulkEditForm):
739743 initial = "" ,
740744 widget = forms .Select (attrs = {"class" : "form-control" }),
741745 )
746+ ownership_type = forms .ChoiceField (
747+ choices = add_blank_choice (OwnershipTypeChoices ),
748+ required = False ,
749+ initial = "" ,
750+ widget = forms .Select (attrs = {"class" : "form-control" }),
751+ )
742752 provider = DynamicModelChoiceField (
743753 queryset = Provider .objects .all (),
744754 required = False ,
@@ -752,5 +762,5 @@ class SegmentBulkEditForm(NetBoxModelBulkEditForm):
752762 comments = CommentField ()
753763
754764 model = Segment
755- fieldsets = (FieldSet ("provider" , "status" , "segment_type" , name = "Segment" ),)
765+ fieldsets = (FieldSet ("provider" , "status" , "ownership_type" , " segment_type" , name = "Segment" ),)
756766 nullable_fields = ("comments" ,)
0 commit comments