2424class OnboardingTaskSerializer (serializers .ModelSerializer ):
2525 """Serializer for the OnboardingTask model."""
2626
27- device = serializers .CharField (required = False , help_text = "Planned device name" ,)
27+ site = serializers .SlugRelatedField (
28+ many = False ,
29+ read_only = False ,
30+ queryset = Site .objects .all (),
31+ slug_field = "slug" ,
32+ required = True ,
33+ help_text = "NetBox site 'slug' value" ,
34+ )
2835
2936 ip_address = serializers .CharField (required = True , help_text = "IP Address to reach device" ,)
3037
@@ -34,14 +41,9 @@ class OnboardingTaskSerializer(serializers.ModelSerializer):
3441
3542 secret = serializers .CharField (required = False , write_only = True , help_text = "Device secret password" ,)
3643
37- site = serializers .SlugRelatedField (
38- many = False ,
39- read_only = False ,
40- queryset = Site .objects .all (),
41- slug_field = "slug" ,
42- required = True ,
43- help_text = "NetBox site 'slug' value" ,
44- )
44+ port = serializers .IntegerField (required = False , help_text = "Device PORT to check for online" )
45+
46+ timeout = serializers .IntegerField (required = False , help_text = "Timeout (sec) for device connect" )
4547
4648 role = serializers .SlugRelatedField (
4749 many = False ,
@@ -63,34 +65,32 @@ class OnboardingTaskSerializer(serializers.ModelSerializer):
6365 help_text = "NetBox Platform 'slug' value" ,
6466 )
6567
66- status = serializers .CharField (required = False , help_text = "Onboarding Status" )
67-
68- failed_reason = serializers .CharField (required = False , help_text = "Failure reason" )
68+ created_device = serializers .CharField (required = False , read_only = True , help_text = "Created device name" ,)
6969
70- message = serializers .CharField (required = False , help_text = "Status message " )
70+ status = serializers .CharField (required = False , read_only = True , help_text = "Onboarding Status " )
7171
72- port = serializers .IntegerField (required = False , help_text = "Device PORT to check for online " )
72+ failed_reason = serializers .CharField (required = False , read_only = True , help_text = "Failure reason " )
7373
74- timeout = serializers .IntegerField (required = False , help_text = "Timeout (sec) for device connect " )
74+ message = serializers .CharField (required = False , read_only = True , help_text = "Status message " )
7575
7676 class Meta : # noqa: D106 "Missing docstring in public nested class"
7777 model = OnboardingTask
7878 fields = [
7979 "id" ,
80- "device " ,
80+ "site " ,
8181 "ip_address" ,
8282 "username" ,
8383 "password" ,
8484 "secret" ,
85- "site" ,
85+ "port" ,
86+ "timeout" ,
8687 "role" ,
8788 "device_type" ,
8889 "platform" ,
90+ "created_device" ,
8991 "status" ,
9092 "failed_reason" ,
9193 "message" ,
92- "port" ,
93- "timeout" ,
9494 ]
9595
9696 def create (self , validated_data ):
0 commit comments