From 279253c486e4aff7f1471c93431c35eb91338237 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Thu, 18 Aug 2022 09:49:45 -0400 Subject: [PATCH] Fixes #10040: Fix exception when ordering prefixes by flat representation --- docs/release-notes/version-3.3.md | 1 + netbox/ipam/tables/ip.py | 15 +++------------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/docs/release-notes/version-3.3.md b/docs/release-notes/version-3.3.md index e633e35de..222ba797b 100644 --- a/docs/release-notes/version-3.3.md +++ b/docs/release-notes/version-3.3.md @@ -4,6 +4,7 @@ ### Bug Fixes +* [#10040](https://github.com/netbox-community/netbox/issues/10040) - Fix exception when ordering prefixes by flat representation * [#10053](https://github.com/netbox-community/netbox/issues/10053) - Custom fields header should not be displayed when editing circuit terminations with no custom fields --- diff --git a/netbox/ipam/tables/ip.py b/netbox/ipam/tables/ip.py index 087d0de73..20e63fe55 100644 --- a/netbox/ipam/tables/ip.py +++ b/netbox/ipam/tables/ip.py @@ -32,15 +32,6 @@ PREFIX_LINK = """ {{ record.prefix }} """ -PREFIXFLAT_LINK = """ -{% load helpers %} -{% if record.pk %} - {{ record.prefix }} -{% else %} - {{ record.prefix }} -{% endif %} -""" - IPADDRESS_LINK = """ {% if record.pk %} {{ record.address }} @@ -229,9 +220,9 @@ class PrefixTable(TenancyColumnsMixin, NetBoxTable): export_raw=True, attrs={'td': {'class': 'text-nowrap'}} ) - prefix_flat = tables.TemplateColumn( - template_code=PREFIXFLAT_LINK, - attrs={'td': {'class': 'text-nowrap'}}, + prefix_flat = tables.Column( + accessor=Accessor('prefix'), + linkify=True, verbose_name='Prefix (Flat)', ) depth = tables.Column(