Skip to content

Fixes #19610: FieldError when sorting Tunnel Termination on tenant #19612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion netbox/vpn/tables/tunnels.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class Meta(NetBoxTable.Meta):
default_columns = ('pk', 'name', 'group', 'status', 'encapsulation', 'tenant', 'terminations_count')


class TunnelTerminationTable(TenancyColumnsMixin, NetBoxTable):
class TunnelTerminationTable(NetBoxTable):
tunnel = tables.Column(
verbose_name=_('Tunnel'),
linkify=True
Expand Down
23 changes: 23 additions & 0 deletions netbox/vpn/tests/test_tables.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from django.test import RequestFactory, tag, TestCase

from vpn.models import TunnelTermination
from vpn.tables import TunnelTerminationTable


@tag('regression')
class TunnelTerminationTableTest(TestCase):
def test_every_orderable_field_does_not_throw_exception(self):
terminations = TunnelTermination.objects.all()
fake_request = RequestFactory().get("/")
disallowed = {'actions'}

orderable_columns = [
column.name for column in TunnelTerminationTable(terminations).columns
if column.orderable and column.name not in disallowed
]

for col in orderable_columns:
for dir in ('-', ''):
table = TunnelTerminationTable(terminations)
table.order_by = f'{dir}{col}'
table.as_html(fake_request)