1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Remove legacy connected endpoint fields

This commit is contained in:
Jeremy Stretch
2020-10-05 09:56:46 -04:00
parent f8800b8303
commit 079c42291c
13 changed files with 190 additions and 263 deletions

View File

@@ -34,8 +34,7 @@ class ConnectedEndpointSerializer(ValidatedModelSerializer):
def get_connected_endpoint_type(self, obj):
if obj.path is not None:
destination = obj.path.destination
return f'{destination._meta.app_label}.{destination._meta.model_name}'
return f'{obj.connected_endpoint._meta.app_label}.{obj.connected_endpoint._meta.model_name}'
return None
@swagger_serializer_method(serializer_or_field=serializers.DictField)
@@ -44,7 +43,7 @@ class ConnectedEndpointSerializer(ValidatedModelSerializer):
Return the appropriate serializer for the type of connected object.
"""
if obj.path is not None:
serializer = get_serializer_for_model(obj.path.destination, prefix='Nested')
serializer = get_serializer_for_model(obj.connected_endpoint, prefix='Nested')
context = {'request': self.context['request']}
return serializer(obj.path.destination, context=context).data
return None