Skip to content

Commit e24fa2e

Browse files
authored
Fixes #19610: FieldError when sorting Tunnel Termination on tenant (#19612)
1 parent 5fe5b2e commit e24fa2e

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

netbox/vpn/tables/tunnels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class Meta(NetBoxTable.Meta):
7373
default_columns = ('pk', 'name', 'group', 'status', 'encapsulation', 'tenant', 'terminations_count')
7474

7575

76-
class TunnelTerminationTable(TenancyColumnsMixin, NetBoxTable):
76+
class TunnelTerminationTable(NetBoxTable):
7777
tunnel = tables.Column(
7878
verbose_name=_('Tunnel'),
7979
linkify=True

netbox/vpn/tests/test_tables.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from django.test import RequestFactory, tag, TestCase
2+
3+
from vpn.models import TunnelTermination
4+
from vpn.tables import TunnelTerminationTable
5+
6+
7+
@tag('regression')
8+
class TunnelTerminationTableTest(TestCase):
9+
def test_every_orderable_field_does_not_throw_exception(self):
10+
terminations = TunnelTermination.objects.all()
11+
fake_request = RequestFactory().get("/")
12+
disallowed = {'actions'}
13+
14+
orderable_columns = [
15+
column.name for column in TunnelTerminationTable(terminations).columns
16+
if column.orderable and column.name not in disallowed
17+
]
18+
19+
for col in orderable_columns:
20+
for dir in ('-', ''):
21+
table = TunnelTerminationTable(terminations)
22+
table.order_by = f'{dir}{col}'
23+
table.as_html(fake_request)

0 commit comments

Comments
 (0)