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

CablePath.origin should be unique

This commit is contained in:
Jeremy Stretch
2020-10-02 11:51:23 -04:00
parent e0abd7ef3e
commit 66355da04c
2 changed files with 9 additions and 1 deletions

View File

@@ -1197,6 +1197,9 @@ class CablePath(models.Model):
objects = CablePathManager()
class Meta:
unique_together = ('origin_type', 'origin_id')
def __str__(self):
path = ', '.join([str(path_node_to_object(node)) for node in self.path])
return f"Path #{self.pk}: {self.origin} to {self.destination} via ({path})"