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

Moved cable caching logic from Cable.save() to signals

This commit is contained in:
Jeremy Stretch
2018-10-31 15:01:01 -04:00
parent 8992c57039
commit d22c23290f
2 changed files with 18 additions and 13 deletions

View File

@@ -68,6 +68,7 @@ class CableTermination(models.Model):
cable = models.ForeignKey(
to='dcim.Cable',
on_delete=models.SET_NULL,
related_name='+',
blank=True,
null=True
)
@@ -2426,12 +2427,6 @@ class Cable(ChangeLoggedModel):
super(Cable, self).save(*args, **kwargs)
# Cache the Cable on its two termination points
self.termination_a.cable = self
self.termination_a.save()
self.termination_b.cable = self
self.termination_b.save()
def get_path_endpoints(self):
"""
Traverse both ends of a cable path and return its connected endpoints. Note that one or both endpoints may be