Add CablePath.get_path() to prefetch path nodes

This commit is contained in:
Jeremy Stretch
2020-10-30 13:32:10 -04:00
parent e86a72b586
commit 0f044cc088
5 changed files with 37 additions and 16 deletions

View File

@@ -21,15 +21,6 @@ def object_to_path_node(obj):
return compile_path_node(ct.pk, obj.pk)
def path_node_to_object(repr):
"""
Given a path node representation, return the corresponding object.
"""
ct_id, object_id = decompile_path_node(repr)
model_class = ContentType.objects.get(pk=ct_id).model_class()
return model_class.objects.get(pk=int(object_id))
def trace_path(node):
from .models import FrontPort, RearPort