mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-13 08:44:51 -06:00
Fixes #19487: fix ordering issues with CircuitTerminationTable/TunnelTerminationTable configuration (#19600)
* Fixes #19487: make CircuitTermination.termination GFK not orderable * Add test to ensure no more broken sorting for CircuitTerminationTable * Fix CircuitTerminationTable.site_group accessor * Make TunnelTerminationTable.termination GFK field non-orderable
This commit is contained in:
parent
ecb8656723
commit
95d0ca56a7
@ -120,7 +120,8 @@ class CircuitTerminationTable(NetBoxTable):
|
||||
)
|
||||
termination = tables.Column(
|
||||
verbose_name=_('Termination Point'),
|
||||
linkify=True
|
||||
linkify=True,
|
||||
orderable=False,
|
||||
)
|
||||
|
||||
# Termination types
|
||||
@ -132,7 +133,7 @@ class CircuitTerminationTable(NetBoxTable):
|
||||
site_group = tables.Column(
|
||||
verbose_name=_('Site Group'),
|
||||
linkify=True,
|
||||
accessor='_sitegroup'
|
||||
accessor='_site_group'
|
||||
)
|
||||
region = tables.Column(
|
||||
verbose_name=_('Region'),
|
||||
|
23
netbox/circuits/tests/test_tables.py
Normal file
23
netbox/circuits/tests/test_tables.py
Normal file
@ -0,0 +1,23 @@
|
||||
from django.test import RequestFactory, tag, TestCase
|
||||
|
||||
from circuits.models import CircuitTermination
|
||||
from circuits.tables import CircuitTerminationTable
|
||||
|
||||
|
||||
@tag('regression')
|
||||
class CircuitTerminationTableTest(TestCase):
|
||||
def test_every_orderable_field_does_not_throw_exception(self):
|
||||
terminations = CircuitTermination.objects.all()
|
||||
disallowed = {'actions', }
|
||||
|
||||
orderable_columns = [
|
||||
column.name for column in CircuitTerminationTable(terminations).columns
|
||||
if column.orderable and column.name not in disallowed
|
||||
]
|
||||
fake_request = RequestFactory().get("/")
|
||||
|
||||
for col in orderable_columns:
|
||||
for dir in ('-', ''):
|
||||
table = CircuitTerminationTable(terminations)
|
||||
table.order_by = f'{dir}{col}'
|
||||
table.as_html(fake_request)
|
@ -89,7 +89,8 @@ class TunnelTerminationTable(TenancyColumnsMixin, NetBoxTable):
|
||||
)
|
||||
termination = tables.Column(
|
||||
verbose_name=_('Tunnel interface'),
|
||||
linkify=True
|
||||
linkify=True,
|
||||
orderable=False,
|
||||
)
|
||||
ip_addresses = columns.ManyToManyColumn(
|
||||
accessor=tables.A('termination__ip_addresses'),
|
||||
|
Loading…
Reference in New Issue
Block a user