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

Update connected_endpoint serializer field to support multiple objects

This commit is contained in:
jeremystretch
2022-05-13 11:04:38 -04:00
parent 3a461d0279
commit 4c51dbba80
5 changed files with 73 additions and 41 deletions

View File

@@ -224,13 +224,13 @@ class PathEndpoint(models.Model):
return self._path
@property
def connected_endpoint(self):
def connected_endpoints(self):
"""
Caching accessor for the attached CablePath's destination (if any)
"""
if not hasattr(self, '_connected_endpoint'):
self._connected_endpoint = self._path.get_destination()
return self._connected_endpoint
if not hasattr(self, '_connected_endpoints'):
self._connected_endpoints = self._path.get_destination() if self._path else []
return self._connected_endpoints
#