From 57556e3fdb17a14fcf68136f5d1d39e09511add6 Mon Sep 17 00:00:00 2001 From: Martin Hauser Date: Thu, 2 Apr 2026 20:17:08 +0200 Subject: [PATCH] fix(tables): Correct sortable column definitions across tables Fix broken sorting metadata caused by incorrect accessors, field references, and naming mismatches in several table definitions. Update accessor paths for provider_account and device order_by; add order_by mapping for the is_active property column; correct field name typos such as termination_count to terminations_count; rename the ssl_validation column to ssl_verification to match the model field; and mark computed columns as orderable=False where sorting is not supported. Fixes #21825 --- netbox/circuits/tables/virtual_circuits.py | 3 ++- netbox/core/tables/config.py | 1 + netbox/dcim/tables/devices.py | 2 +- netbox/dcim/tables/modules.py | 4 +++- netbox/extras/tables/tables.py | 5 +++-- netbox/ipam/tables/vlans.py | 2 +- netbox/vpn/tables/tunnels.py | 2 +- 7 files changed, 12 insertions(+), 7 deletions(-) diff --git a/netbox/circuits/tables/virtual_circuits.py b/netbox/circuits/tables/virtual_circuits.py index 43f03675b..84bbebf33 100644 --- a/netbox/circuits/tables/virtual_circuits.py +++ b/netbox/circuits/tables/virtual_circuits.py @@ -95,6 +95,7 @@ class VirtualCircuitTerminationTable(NetBoxTable): verbose_name=_('Provider network') ) provider_account = tables.Column( + accessor=tables.A('virtual_circuit__provider_account'), linkify=True, verbose_name=_('Account') ) @@ -112,7 +113,7 @@ class VirtualCircuitTerminationTable(NetBoxTable): class Meta(NetBoxTable.Meta): model = VirtualCircuitTermination fields = ( - 'pk', 'id', 'virtual_circuit', 'provider', 'provider_network', 'provider_account', 'role', 'interfaces', + 'pk', 'id', 'virtual_circuit', 'provider', 'provider_network', 'provider_account', 'role', 'interface', 'description', 'created', 'last_updated', 'actions', ) default_columns = ( diff --git a/netbox/core/tables/config.py b/netbox/core/tables/config.py index 018d89edf..0562f9199 100644 --- a/netbox/core/tables/config.py +++ b/netbox/core/tables/config.py @@ -19,6 +19,7 @@ REVISION_BUTTONS = """ class ConfigRevisionTable(NetBoxTable): is_active = columns.BooleanColumn( verbose_name=_('Is Active'), + accessor='active', false_mark=None ) actions = columns.ActionsColumn( diff --git a/netbox/dcim/tables/devices.py b/netbox/dcim/tables/devices.py index e6985a780..67f7baad7 100644 --- a/netbox/dcim/tables/devices.py +++ b/netbox/dcim/tables/devices.py @@ -1149,7 +1149,7 @@ class VirtualDeviceContextTable(TenancyColumnsMixin, PrimaryModelTable): ) device = tables.Column( verbose_name=_('Device'), - order_by=('device___name',), + order_by=('device__name',), linkify=True ) status = columns.ChoiceFieldColumn( diff --git a/netbox/dcim/tables/modules.py b/netbox/dcim/tables/modules.py index 8e857072c..948c7a664 100644 --- a/netbox/dcim/tables/modules.py +++ b/netbox/dcim/tables/modules.py @@ -56,7 +56,9 @@ class ModuleTypeTable(PrimaryModelTable): template_code=WEIGHT, order_by=('_abs_weight', 'weight_unit') ) - attributes = columns.DictColumn() + attributes = columns.DictColumn( + orderable=False, + ) module_count = columns.LinkedCountColumn( viewname='dcim:module_list', url_params={'module_type_id': 'pk'}, diff --git a/netbox/extras/tables/tables.py b/netbox/extras/tables/tables.py index cc1165e7c..3ca68a922 100644 --- a/netbox/extras/tables/tables.py +++ b/netbox/extras/tables/tables.py @@ -417,6 +417,7 @@ class NotificationTable(NetBoxTable): icon = columns.TemplateColumn( template_code=NOTIFICATION_ICON, accessor=tables.A('event'), + orderable=False, attrs={ 'td': {'class': 'w-1'}, 'th': {'class': 'w-1'}, @@ -479,8 +480,8 @@ class WebhookTable(NetBoxTable): verbose_name=_('Name'), linkify=True ) - ssl_validation = columns.BooleanColumn( - verbose_name=_('SSL Validation') + ssl_verification = columns.BooleanColumn( + verbose_name=_('SSL Verification'), ) owner = tables.Column( linkify=True, diff --git a/netbox/ipam/tables/vlans.py b/netbox/ipam/tables/vlans.py index 2082ea616..1727faeaa 100644 --- a/netbox/ipam/tables/vlans.py +++ b/netbox/ipam/tables/vlans.py @@ -247,6 +247,6 @@ class VLANTranslationRuleTable(NetBoxTable): class Meta(NetBoxTable.Meta): model = VLANTranslationRule fields = ( - 'pk', 'id', 'name', 'policy', 'local_vid', 'remote_vid', 'description', 'tags', 'created', 'last_updated', + 'pk', 'id', 'policy', 'local_vid', 'remote_vid', 'description', 'tags', 'created', 'last_updated', ) default_columns = ('pk', 'policy', 'local_vid', 'remote_vid', 'description') diff --git a/netbox/vpn/tables/tunnels.py b/netbox/vpn/tables/tunnels.py index d1a4fc7c9..605a56b42 100644 --- a/netbox/vpn/tables/tunnels.py +++ b/netbox/vpn/tables/tunnels.py @@ -66,7 +66,7 @@ class TunnelTable(TenancyColumnsMixin, ContactsColumnMixin, PrimaryModelTable): model = Tunnel fields = ( 'pk', 'id', 'name', 'group', 'status', 'encapsulation', 'ipsec_profile', 'tenant', 'tenant_group', - 'tunnel_id', 'termination_count', 'description', 'contacts', 'comments', 'tags', 'created', + 'tunnel_id', 'terminations_count', 'description', 'contacts', 'comments', 'tags', 'created', 'last_updated', ) default_columns = ('pk', 'name', 'group', 'status', 'encapsulation', 'tenant', 'terminations_count')