mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-25 18:08:38 -06:00
Add segment_count property to CablePath
This commit is contained in:
parent
542d3fb56f
commit
ccf17296c4
@ -379,6 +379,11 @@ class CablePath(models.Model):
|
|||||||
model = self.origin._meta.model
|
model = self.origin._meta.model
|
||||||
model.objects.filter(pk=self.origin.pk).update(_path=self.pk)
|
model.objects.filter(pk=self.origin.pk).update(_path=self.pk)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def segment_count(self):
|
||||||
|
total_length = 1 + len(self.path) + (1 if self.destination else 0)
|
||||||
|
return int(total_length / 3)
|
||||||
|
|
||||||
def get_path(self):
|
def get_path(self):
|
||||||
"""
|
"""
|
||||||
Return the path as a list of prefetched objects.
|
Return the path as a list of prefetched objects.
|
||||||
|
Loading…
Reference in New Issue
Block a user