mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-20 10:16:42 -06:00
This commit is contained in:
parent
3d3748d6f5
commit
d2c8aae59c
@ -1,5 +1,6 @@
|
|||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
from django_tables2.utils import Accessor
|
from django_tables2.utils import Accessor
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
from dcim.models import (
|
from dcim.models import (
|
||||||
ConsolePort, ConsoleServerPort, Device, DeviceBay, DeviceRole, FrontPort, Interface, InventoryItem, Platform,
|
ConsolePort, ConsoleServerPort, Device, DeviceBay, DeviceRole, FrontPort, Interface, InventoryItem, Platform,
|
||||||
@ -127,6 +128,13 @@ class DeviceTable(BaseTable):
|
|||||||
verbose_name='Type',
|
verbose_name='Type',
|
||||||
text=lambda record: record.device_type.display_name
|
text=lambda record: record.device_type.display_name
|
||||||
)
|
)
|
||||||
|
if settings.PREFER_IPV4:
|
||||||
|
primary_ip = tables.Column(
|
||||||
|
linkify=True,
|
||||||
|
order_by=('primary_ip4', 'primary_ip6'),
|
||||||
|
verbose_name='IP Address'
|
||||||
|
)
|
||||||
|
else:
|
||||||
primary_ip = tables.Column(
|
primary_ip = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
order_by=('primary_ip6', 'primary_ip4'),
|
order_by=('primary_ip6', 'primary_ip4'),
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
|
from django.conf import settings
|
||||||
from dcim.tables.devices import BaseInterfaceTable
|
from dcim.tables.devices import BaseInterfaceTable
|
||||||
from tenancy.tables import COL_TENANT
|
from tenancy.tables import COL_TENANT
|
||||||
from utilities.tables import (
|
from utilities.tables import (
|
||||||
@ -125,8 +125,16 @@ class VirtualMachineDetailTable(VirtualMachineTable):
|
|||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='IPv6 Address'
|
verbose_name='IPv6 Address'
|
||||||
)
|
)
|
||||||
|
if settings.PREFER_IPV4:
|
||||||
primary_ip = tables.Column(
|
primary_ip = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
|
order_by=('primary_ip4', 'primary_ip6'),
|
||||||
|
verbose_name='IP Address'
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
primary_ip = tables.Column(
|
||||||
|
linkify=True,
|
||||||
|
order_by=('primary_ip6', 'primary_ip4'),
|
||||||
verbose_name='IP Address'
|
verbose_name='IP Address'
|
||||||
)
|
)
|
||||||
tags = TagColumn(
|
tags = TagColumn(
|
||||||
|
Loading…
Reference in New Issue
Block a user