mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Capture path end-to-end status in CablePath
This commit is contained in:
@@ -30,7 +30,7 @@ from .nested_serializers import *
|
||||
class ConnectedEndpointSerializer(ValidatedModelSerializer):
|
||||
connected_endpoint_type = serializers.SerializerMethodField(read_only=True)
|
||||
connected_endpoint = serializers.SerializerMethodField(read_only=True)
|
||||
connection_status = ChoiceField(choices=CONNECTION_STATUS_CHOICES, read_only=True)
|
||||
connection_status = serializers.SerializerMethodField(read_only=True)
|
||||
|
||||
def get_connected_endpoint_type(self, obj):
|
||||
if obj.path is not None:
|
||||
@@ -49,6 +49,13 @@ class ConnectedEndpointSerializer(ValidatedModelSerializer):
|
||||
return serializer(obj.path.destination, context=context).data
|
||||
return None
|
||||
|
||||
# TODO: Tweak the representation for this field
|
||||
@swagger_serializer_method(serializer_or_field=serializers.BooleanField)
|
||||
def get_connection_status(self, obj):
|
||||
if obj.path is not None:
|
||||
return obj.path.is_connected
|
||||
return None
|
||||
|
||||
|
||||
#
|
||||
# Regions/sites
|
||||
|
Reference in New Issue
Block a user