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(