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__(