From 7e481960f9035ccc168a5063c9510b127f8846dc Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Mon, 14 Jun 2021 09:19:05 -0400 Subject: [PATCH] Optimize MPTTColumn rendering --- netbox/utilities/tables.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/netbox/utilities/tables.py b/netbox/utilities/tables.py index 14dc3ab6d..b0797fa50 100644 --- a/netbox/utilities/tables.py +++ b/netbox/utilities/tables.py @@ -340,8 +340,11 @@ class MPTTColumn(tables.TemplateColumn): """ Display a nested hierarchy for MPTT-enabled models. """ - template_code = """{% for i in record.get_ancestors %}{% endfor %}""" \ - """{{ record.name }}""" + template_code = """ + {% load helpers %} + {% for i in record.level|as_range %}{% endfor %} + {{ record.name }} + """ def __init__(self, *args, **kwargs): super().__init__(