mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Replace TenantColumn with new TenancyColumnsMixin
Replaces all usages of the TenantColumn with the new TenancyColumnsMixin. This enables the user to add a column for Tenant Group on all tables which also has a column for Tenant.
This commit is contained in:
@ -2,7 +2,7 @@ import django_tables2 as tables
|
|||||||
|
|
||||||
from circuits.models import *
|
from circuits.models import *
|
||||||
from netbox.tables import NetBoxTable, columns
|
from netbox.tables import NetBoxTable, columns
|
||||||
from tenancy.tables import TenantColumn
|
from tenancy.tables import TenancyColumnsMixin
|
||||||
from .columns import CommitRateColumn
|
from .columns import CommitRateColumn
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
@ -39,7 +39,7 @@ class CircuitTypeTable(NetBoxTable):
|
|||||||
default_columns = ('pk', 'name', 'circuit_count', 'description', 'slug')
|
default_columns = ('pk', 'name', 'circuit_count', 'description', 'slug')
|
||||||
|
|
||||||
|
|
||||||
class CircuitTable(NetBoxTable):
|
class CircuitTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
cid = tables.Column(
|
cid = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='Circuit ID'
|
verbose_name='Circuit ID'
|
||||||
@ -48,7 +48,6 @@ class CircuitTable(NetBoxTable):
|
|||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
status = columns.ChoiceFieldColumn()
|
status = columns.ChoiceFieldColumn()
|
||||||
tenant = TenantColumn()
|
|
||||||
termination_a = tables.TemplateColumn(
|
termination_a = tables.TemplateColumn(
|
||||||
template_code=CIRCUITTERMINATION_LINK,
|
template_code=CIRCUITTERMINATION_LINK,
|
||||||
verbose_name='Side A'
|
verbose_name='Side A'
|
||||||
@ -69,7 +68,7 @@ class CircuitTable(NetBoxTable):
|
|||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = Circuit
|
model = Circuit
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'id', 'cid', 'provider', 'type', 'status', 'tenant', 'termination_a', 'termination_z', 'install_date',
|
'pk', 'id', 'cid', 'provider', 'type', 'status', 'tenant', 'tenant_group', 'termination_a', 'termination_z', 'install_date',
|
||||||
'commit_rate', 'description', 'comments', 'contacts', 'tags', 'created', 'last_updated',
|
'commit_rate', 'description', 'comments', 'contacts', 'tags', 'created', 'last_updated',
|
||||||
)
|
)
|
||||||
default_columns = (
|
default_columns = (
|
||||||
|
@ -3,7 +3,7 @@ from django_tables2.utils import Accessor
|
|||||||
|
|
||||||
from dcim.models import Cable
|
from dcim.models import Cable
|
||||||
from netbox.tables import NetBoxTable, columns
|
from netbox.tables import NetBoxTable, columns
|
||||||
from tenancy.tables import TenantColumn
|
from tenancy.tables import TenancyColumnsMixin
|
||||||
from .template_code import CABLE_LENGTH, CABLE_TERMINATION_PARENT
|
from .template_code import CABLE_LENGTH, CABLE_TERMINATION_PARENT
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
@ -15,7 +15,7 @@ __all__ = (
|
|||||||
# Cables
|
# Cables
|
||||||
#
|
#
|
||||||
|
|
||||||
class CableTable(NetBoxTable):
|
class CableTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
termination_a_parent = tables.TemplateColumn(
|
termination_a_parent = tables.TemplateColumn(
|
||||||
template_code=CABLE_TERMINATION_PARENT,
|
template_code=CABLE_TERMINATION_PARENT,
|
||||||
accessor=Accessor('termination_a'),
|
accessor=Accessor('termination_a'),
|
||||||
@ -53,7 +53,6 @@ class CableTable(NetBoxTable):
|
|||||||
verbose_name='Termination B'
|
verbose_name='Termination B'
|
||||||
)
|
)
|
||||||
status = columns.ChoiceFieldColumn()
|
status = columns.ChoiceFieldColumn()
|
||||||
tenant = TenantColumn()
|
|
||||||
length = columns.TemplateColumn(
|
length = columns.TemplateColumn(
|
||||||
template_code=CABLE_LENGTH,
|
template_code=CABLE_LENGTH,
|
||||||
order_by=('_abs_length', 'length_unit')
|
order_by=('_abs_length', 'length_unit')
|
||||||
@ -67,7 +66,7 @@ class CableTable(NetBoxTable):
|
|||||||
model = Cable
|
model = Cable
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'id', 'label', 'termination_a_parent', 'rack_a', 'termination_a', 'termination_b_parent', 'rack_b', 'termination_b',
|
'pk', 'id', 'label', 'termination_a_parent', 'rack_a', 'termination_a', 'termination_b_parent', 'rack_b', 'termination_b',
|
||||||
'status', 'type', 'tenant', 'color', 'length', 'tags', 'created', 'last_updated',
|
'status', 'type', 'tenant', 'tenant_group', 'color', 'length', 'tags', 'created', 'last_updated',
|
||||||
)
|
)
|
||||||
default_columns = (
|
default_columns = (
|
||||||
'pk', 'id', 'label', 'termination_a_parent', 'termination_a', 'termination_b_parent', 'termination_b',
|
'pk', 'id', 'label', 'termination_a_parent', 'termination_a', 'termination_b_parent', 'termination_b',
|
||||||
|
@ -6,7 +6,7 @@ from dcim.models import (
|
|||||||
InventoryItemRole, ModuleBay, Platform, PowerOutlet, PowerPort, RearPort, VirtualChassis,
|
InventoryItemRole, ModuleBay, Platform, PowerOutlet, PowerPort, RearPort, VirtualChassis,
|
||||||
)
|
)
|
||||||
from netbox.tables import NetBoxTable, columns
|
from netbox.tables import NetBoxTable, columns
|
||||||
from tenancy.tables import TenantColumn
|
from tenancy.tables import TenancyColumnsMixin
|
||||||
from .template_code import *
|
from .template_code import *
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
@ -137,13 +137,12 @@ class PlatformTable(NetBoxTable):
|
|||||||
# Devices
|
# Devices
|
||||||
#
|
#
|
||||||
|
|
||||||
class DeviceTable(NetBoxTable):
|
class DeviceTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
name = tables.TemplateColumn(
|
name = tables.TemplateColumn(
|
||||||
order_by=('_name',),
|
order_by=('_name',),
|
||||||
template_code=DEVICE_LINK
|
template_code=DEVICE_LINK
|
||||||
)
|
)
|
||||||
status = columns.ChoiceFieldColumn()
|
status = columns.ChoiceFieldColumn()
|
||||||
tenant = TenantColumn()
|
|
||||||
site = tables.Column(
|
site = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
@ -200,7 +199,7 @@ class DeviceTable(NetBoxTable):
|
|||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = Device
|
model = Device
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'id', 'name', 'status', 'tenant', 'device_role', 'manufacturer', 'device_type', 'platform', 'serial',
|
'pk', 'id', 'name', 'status', 'tenant', 'tenant_group', 'device_role', 'manufacturer', 'device_type', 'platform', 'serial',
|
||||||
'asset_tag', 'site', 'location', 'rack', 'position', 'face', 'primary_ip', 'airflow', 'primary_ip4',
|
'asset_tag', 'site', 'location', 'rack', 'position', 'face', 'primary_ip', 'airflow', 'primary_ip4',
|
||||||
'primary_ip6', 'cluster', 'virtual_chassis', 'vc_position', 'vc_priority', 'comments', 'contacts', 'tags',
|
'primary_ip6', 'cluster', 'virtual_chassis', 'vc_position', 'vc_priority', 'comments', 'contacts', 'tags',
|
||||||
'created', 'last_updated',
|
'created', 'last_updated',
|
||||||
@ -211,12 +210,11 @@ class DeviceTable(NetBoxTable):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class DeviceImportTable(NetBoxTable):
|
class DeviceImportTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
name = tables.TemplateColumn(
|
name = tables.TemplateColumn(
|
||||||
template_code=DEVICE_LINK
|
template_code=DEVICE_LINK
|
||||||
)
|
)
|
||||||
status = columns.ChoiceFieldColumn()
|
status = columns.ChoiceFieldColumn()
|
||||||
tenant = TenantColumn()
|
|
||||||
site = tables.Column(
|
site = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
@ -232,7 +230,7 @@ class DeviceImportTable(NetBoxTable):
|
|||||||
|
|
||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = Device
|
model = Device
|
||||||
fields = ('id', 'name', 'status', 'tenant', 'site', 'rack', 'position', 'device_role', 'device_type')
|
fields = ('id', 'name', 'status', 'tenant', 'tenant_group', 'site', 'rack', 'position', 'device_role', 'device_type')
|
||||||
empty_text = False
|
empty_text = False
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ from django_tables2.utils import Accessor
|
|||||||
|
|
||||||
from dcim.models import Rack, RackReservation, RackRole
|
from dcim.models import Rack, RackReservation, RackRole
|
||||||
from netbox.tables import NetBoxTable, columns
|
from netbox.tables import NetBoxTable, columns
|
||||||
from tenancy.tables import TenantColumn
|
from tenancy.tables import TenancyColumnsMixin
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
'RackTable',
|
'RackTable',
|
||||||
@ -37,7 +37,7 @@ class RackRoleTable(NetBoxTable):
|
|||||||
# Racks
|
# Racks
|
||||||
#
|
#
|
||||||
|
|
||||||
class RackTable(NetBoxTable):
|
class RackTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
order_by=('_name',),
|
order_by=('_name',),
|
||||||
linkify=True
|
linkify=True
|
||||||
@ -48,7 +48,6 @@ class RackTable(NetBoxTable):
|
|||||||
site = tables.Column(
|
site = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
tenant = TenantColumn()
|
|
||||||
status = columns.ChoiceFieldColumn()
|
status = columns.ChoiceFieldColumn()
|
||||||
role = columns.ColoredLabelColumn()
|
role = columns.ColoredLabelColumn()
|
||||||
u_height = tables.TemplateColumn(
|
u_height = tables.TemplateColumn(
|
||||||
@ -87,7 +86,7 @@ class RackTable(NetBoxTable):
|
|||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = Rack
|
model = Rack
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'id', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'role', 'serial', 'asset_tag',
|
'pk', 'id', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'tenant_group', 'role', 'serial', 'asset_tag',
|
||||||
'type', 'width', 'outer_width', 'outer_depth', 'u_height', 'comments', 'device_count', 'get_utilization',
|
'type', 'width', 'outer_width', 'outer_depth', 'u_height', 'comments', 'device_count', 'get_utilization',
|
||||||
'get_power_utilization', 'contacts', 'tags', 'created', 'last_updated',
|
'get_power_utilization', 'contacts', 'tags', 'created', 'last_updated',
|
||||||
)
|
)
|
||||||
@ -101,7 +100,7 @@ class RackTable(NetBoxTable):
|
|||||||
# Rack reservations
|
# Rack reservations
|
||||||
#
|
#
|
||||||
|
|
||||||
class RackReservationTable(NetBoxTable):
|
class RackReservationTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
reservation = tables.Column(
|
reservation = tables.Column(
|
||||||
accessor='pk',
|
accessor='pk',
|
||||||
linkify=True
|
linkify=True
|
||||||
@ -110,7 +109,6 @@ class RackReservationTable(NetBoxTable):
|
|||||||
accessor=Accessor('rack__site'),
|
accessor=Accessor('rack__site'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
tenant = TenantColumn()
|
|
||||||
rack = tables.Column(
|
rack = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
@ -125,7 +123,7 @@ class RackReservationTable(NetBoxTable):
|
|||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = RackReservation
|
model = RackReservation
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'id', 'reservation', 'site', 'rack', 'unit_list', 'user', 'created', 'tenant', 'description', 'tags',
|
'pk', 'id', 'reservation', 'site', 'rack', 'unit_list', 'user', 'created', 'tenant', 'tenant_group', 'description', 'tags',
|
||||||
'actions', 'created', 'last_updated',
|
'actions', 'created', 'last_updated',
|
||||||
)
|
)
|
||||||
default_columns = ('pk', 'reservation', 'site', 'rack', 'unit_list', 'user', 'description')
|
default_columns = ('pk', 'reservation', 'site', 'rack', 'unit_list', 'user', 'description')
|
||||||
|
@ -2,7 +2,7 @@ import django_tables2 as tables
|
|||||||
|
|
||||||
from dcim.models import Location, Region, Site, SiteGroup
|
from dcim.models import Location, Region, Site, SiteGroup
|
||||||
from netbox.tables import NetBoxTable, columns
|
from netbox.tables import NetBoxTable, columns
|
||||||
from tenancy.tables import TenantColumn
|
from tenancy.tables import TenancyColumnsMixin
|
||||||
from .template_code import LOCATION_BUTTONS
|
from .template_code import LOCATION_BUTTONS
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
@ -75,7 +75,7 @@ class SiteGroupTable(NetBoxTable):
|
|||||||
# Sites
|
# Sites
|
||||||
#
|
#
|
||||||
|
|
||||||
class SiteTable(NetBoxTable):
|
class SiteTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
@ -96,7 +96,6 @@ class SiteTable(NetBoxTable):
|
|||||||
url_params={'site_id': 'pk'},
|
url_params={'site_id': 'pk'},
|
||||||
verbose_name='ASN Count'
|
verbose_name='ASN Count'
|
||||||
)
|
)
|
||||||
tenant = TenantColumn()
|
|
||||||
comments = columns.MarkdownColumn()
|
comments = columns.MarkdownColumn()
|
||||||
contacts = columns.ManyToManyColumn(
|
contacts = columns.ManyToManyColumn(
|
||||||
linkify_item=True
|
linkify_item=True
|
||||||
@ -108,7 +107,7 @@ class SiteTable(NetBoxTable):
|
|||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = Site
|
model = Site
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'id', 'name', 'slug', 'status', 'facility', 'region', 'group', 'tenant', 'asns', 'asn_count',
|
'pk', 'id', 'name', 'slug', 'status', 'facility', 'region', 'group', 'tenant', 'tenant_group', 'asns', 'asn_count',
|
||||||
'time_zone', 'description', 'physical_address', 'shipping_address', 'latitude', 'longitude', 'comments',
|
'time_zone', 'description', 'physical_address', 'shipping_address', 'latitude', 'longitude', 'comments',
|
||||||
'contacts', 'tags', 'created', 'last_updated', 'actions',
|
'contacts', 'tags', 'created', 'last_updated', 'actions',
|
||||||
)
|
)
|
||||||
@ -119,14 +118,13 @@ class SiteTable(NetBoxTable):
|
|||||||
# Locations
|
# Locations
|
||||||
#
|
#
|
||||||
|
|
||||||
class LocationTable(NetBoxTable):
|
class LocationTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
name = columns.MPTTColumn(
|
name = columns.MPTTColumn(
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
site = tables.Column(
|
site = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
tenant = TenantColumn()
|
|
||||||
rack_count = columns.LinkedCountColumn(
|
rack_count = columns.LinkedCountColumn(
|
||||||
viewname='dcim:rack_list',
|
viewname='dcim:rack_list',
|
||||||
url_params={'location_id': 'pk'},
|
url_params={'location_id': 'pk'},
|
||||||
@ -150,7 +148,7 @@ class LocationTable(NetBoxTable):
|
|||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = Location
|
model = Location
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'id', 'name', 'site', 'tenant', 'rack_count', 'device_count', 'description', 'slug', 'contacts',
|
'pk', 'id', 'name', 'site', 'tenant', 'tenant_group', 'rack_count', 'device_count', 'description', 'slug', 'contacts',
|
||||||
'tags', 'actions', 'created', 'last_updated',
|
'tags', 'actions', 'created', 'last_updated',
|
||||||
)
|
)
|
||||||
default_columns = ('pk', 'name', 'site', 'tenant', 'rack_count', 'device_count', 'description')
|
default_columns = ('pk', 'name', 'site', 'tenant', 'rack_count', 'device_count', 'description')
|
||||||
|
@ -4,7 +4,7 @@ from django_tables2.utils import Accessor
|
|||||||
|
|
||||||
from ipam.models import *
|
from ipam.models import *
|
||||||
from netbox.tables import NetBoxTable, columns
|
from netbox.tables import NetBoxTable, columns
|
||||||
from tenancy.tables import TenantColumn
|
from tenancy.tables import TenancyColumnsMixin
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
'AggregateTable',
|
'AggregateTable',
|
||||||
@ -99,7 +99,7 @@ class RIRTable(NetBoxTable):
|
|||||||
# ASNs
|
# ASNs
|
||||||
#
|
#
|
||||||
|
|
||||||
class ASNTable(NetBoxTable):
|
class ASNTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
asn = tables.Column(
|
asn = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
@ -122,7 +122,6 @@ class ASNTable(NetBoxTable):
|
|||||||
linkify_item=True,
|
linkify_item=True,
|
||||||
verbose_name='Sites'
|
verbose_name='Sites'
|
||||||
)
|
)
|
||||||
tenant = TenantColumn()
|
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='ipam:asn_list'
|
url_name='ipam:asn_list'
|
||||||
)
|
)
|
||||||
@ -130,7 +129,7 @@ class ASNTable(NetBoxTable):
|
|||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = ASN
|
model = ASN
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'asn', 'asn_asdot', 'rir', 'site_count', 'provider_count', 'tenant', 'description', 'sites', 'tags',
|
'pk', 'asn', 'asn_asdot', 'rir', 'site_count', 'provider_count', 'tenant', 'tenant_group', 'description', 'sites', 'tags',
|
||||||
'created', 'last_updated', 'actions',
|
'created', 'last_updated', 'actions',
|
||||||
)
|
)
|
||||||
default_columns = ('pk', 'asn', 'rir', 'site_count', 'provider_count', 'sites', 'description', 'tenant')
|
default_columns = ('pk', 'asn', 'rir', 'site_count', 'provider_count', 'sites', 'description', 'tenant')
|
||||||
@ -140,12 +139,11 @@ class ASNTable(NetBoxTable):
|
|||||||
# Aggregates
|
# Aggregates
|
||||||
#
|
#
|
||||||
|
|
||||||
class AggregateTable(NetBoxTable):
|
class AggregateTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
prefix = tables.Column(
|
prefix = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
verbose_name='Aggregate'
|
verbose_name='Aggregate'
|
||||||
)
|
)
|
||||||
tenant = TenantColumn()
|
|
||||||
date_added = tables.DateColumn(
|
date_added = tables.DateColumn(
|
||||||
format="Y-m-d",
|
format="Y-m-d",
|
||||||
verbose_name='Added'
|
verbose_name='Added'
|
||||||
@ -164,7 +162,7 @@ class AggregateTable(NetBoxTable):
|
|||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = Aggregate
|
model = Aggregate
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'id', 'prefix', 'rir', 'tenant', 'child_count', 'utilization', 'date_added', 'description', 'tags',
|
'pk', 'id', 'prefix', 'rir', 'tenant', 'tenant_group', 'child_count', 'utilization', 'date_added', 'description', 'tags',
|
||||||
'created', 'last_updated',
|
'created', 'last_updated',
|
||||||
)
|
)
|
||||||
default_columns = ('pk', 'prefix', 'rir', 'tenant', 'child_count', 'utilization', 'date_added', 'description')
|
default_columns = ('pk', 'prefix', 'rir', 'tenant', 'child_count', 'utilization', 'date_added', 'description')
|
||||||
@ -225,7 +223,7 @@ class PrefixUtilizationColumn(columns.UtilizationColumn):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class PrefixTable(NetBoxTable):
|
class PrefixTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
prefix = columns.TemplateColumn(
|
prefix = columns.TemplateColumn(
|
||||||
template_code=PREFIX_LINK,
|
template_code=PREFIX_LINK,
|
||||||
export_raw=True,
|
export_raw=True,
|
||||||
@ -256,7 +254,6 @@ class PrefixTable(NetBoxTable):
|
|||||||
template_code=VRF_LINK,
|
template_code=VRF_LINK,
|
||||||
verbose_name='VRF'
|
verbose_name='VRF'
|
||||||
)
|
)
|
||||||
tenant = TenantColumn()
|
|
||||||
site = tables.Column(
|
site = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
@ -289,7 +286,7 @@ class PrefixTable(NetBoxTable):
|
|||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = Prefix
|
model = Prefix
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'id', 'prefix', 'prefix_flat', 'status', 'children', 'vrf', 'utilization', 'tenant', 'site',
|
'pk', 'id', 'prefix', 'prefix_flat', 'status', 'children', 'vrf', 'utilization', 'tenant', 'tenant_group', 'site',
|
||||||
'vlan_group', 'vlan', 'role', 'is_pool', 'mark_utilized', 'description', 'tags', 'created', 'last_updated',
|
'vlan_group', 'vlan', 'role', 'is_pool', 'mark_utilized', 'description', 'tags', 'created', 'last_updated',
|
||||||
)
|
)
|
||||||
default_columns = (
|
default_columns = (
|
||||||
@ -303,7 +300,7 @@ class PrefixTable(NetBoxTable):
|
|||||||
#
|
#
|
||||||
# IP ranges
|
# IP ranges
|
||||||
#
|
#
|
||||||
class IPRangeTable(NetBoxTable):
|
class IPRangeTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
start_address = tables.Column(
|
start_address = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
@ -317,7 +314,6 @@ class IPRangeTable(NetBoxTable):
|
|||||||
role = tables.Column(
|
role = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
tenant = TenantColumn()
|
|
||||||
utilization = columns.UtilizationColumn(
|
utilization = columns.UtilizationColumn(
|
||||||
accessor='utilization',
|
accessor='utilization',
|
||||||
orderable=False
|
orderable=False
|
||||||
@ -329,7 +325,7 @@ class IPRangeTable(NetBoxTable):
|
|||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = IPRange
|
model = IPRange
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'id', 'start_address', 'end_address', 'size', 'vrf', 'status', 'role', 'tenant', 'description',
|
'pk', 'id', 'start_address', 'end_address', 'size', 'vrf', 'status', 'role', 'tenant', 'tenant_group', 'description',
|
||||||
'utilization', 'tags', 'created', 'last_updated',
|
'utilization', 'tags', 'created', 'last_updated',
|
||||||
)
|
)
|
||||||
default_columns = (
|
default_columns = (
|
||||||
@ -344,7 +340,7 @@ class IPRangeTable(NetBoxTable):
|
|||||||
# IPAddresses
|
# IPAddresses
|
||||||
#
|
#
|
||||||
|
|
||||||
class IPAddressTable(NetBoxTable):
|
class IPAddressTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
address = tables.TemplateColumn(
|
address = tables.TemplateColumn(
|
||||||
template_code=IPADDRESS_LINK,
|
template_code=IPADDRESS_LINK,
|
||||||
verbose_name='IP Address'
|
verbose_name='IP Address'
|
||||||
@ -357,7 +353,6 @@ class IPAddressTable(NetBoxTable):
|
|||||||
default=AVAILABLE_LABEL
|
default=AVAILABLE_LABEL
|
||||||
)
|
)
|
||||||
role = columns.ChoiceFieldColumn()
|
role = columns.ChoiceFieldColumn()
|
||||||
tenant = TenantColumn()
|
|
||||||
assigned_object = tables.Column(
|
assigned_object = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
orderable=False,
|
orderable=False,
|
||||||
@ -386,7 +381,7 @@ class IPAddressTable(NetBoxTable):
|
|||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = IPAddress
|
model = IPAddress
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'id', 'address', 'vrf', 'status', 'role', 'tenant', 'nat_inside', 'assigned', 'dns_name', 'description',
|
'pk', 'id', 'address', 'vrf', 'status', 'role', 'tenant', 'tenant_group', 'nat_inside', 'assigned', 'dns_name', 'description',
|
||||||
'tags', 'created', 'last_updated',
|
'tags', 'created', 'last_updated',
|
||||||
)
|
)
|
||||||
default_columns = (
|
default_columns = (
|
||||||
@ -414,7 +409,7 @@ class IPAddressAssignTable(NetBoxTable):
|
|||||||
orderable = False
|
orderable = False
|
||||||
|
|
||||||
|
|
||||||
class AssignedIPAddressesTable(NetBoxTable):
|
class AssignedIPAddressesTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
"""
|
"""
|
||||||
List IP addresses assigned to an object.
|
List IP addresses assigned to an object.
|
||||||
"""
|
"""
|
||||||
@ -427,9 +422,8 @@ class AssignedIPAddressesTable(NetBoxTable):
|
|||||||
verbose_name='VRF'
|
verbose_name='VRF'
|
||||||
)
|
)
|
||||||
status = columns.ChoiceFieldColumn()
|
status = columns.ChoiceFieldColumn()
|
||||||
tenant = TenantColumn()
|
|
||||||
|
|
||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = IPAddress
|
model = IPAddress
|
||||||
fields = ('address', 'vrf', 'status', 'role', 'tenant', 'description')
|
fields = ('address', 'vrf', 'status', 'role', 'tenant', 'tenant_group', 'description')
|
||||||
exclude = ('id', )
|
exclude = ('id', )
|
||||||
|
@ -5,7 +5,7 @@ from django_tables2.utils import Accessor
|
|||||||
from dcim.models import Interface
|
from dcim.models import Interface
|
||||||
from ipam.models import *
|
from ipam.models import *
|
||||||
from netbox.tables import NetBoxTable, columns
|
from netbox.tables import NetBoxTable, columns
|
||||||
from tenancy.tables import TenantColumn
|
from tenancy.tables import TenancyColumnsMixin
|
||||||
from virtualization.models import VMInterface
|
from virtualization.models import VMInterface
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
@ -90,7 +90,7 @@ class VLANGroupTable(NetBoxTable):
|
|||||||
# VLANs
|
# VLANs
|
||||||
#
|
#
|
||||||
|
|
||||||
class VLANTable(NetBoxTable):
|
class VLANTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
vid = tables.TemplateColumn(
|
vid = tables.TemplateColumn(
|
||||||
template_code=VLAN_LINK,
|
template_code=VLAN_LINK,
|
||||||
verbose_name='VID'
|
verbose_name='VID'
|
||||||
@ -104,7 +104,6 @@ class VLANTable(NetBoxTable):
|
|||||||
group = tables.Column(
|
group = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
tenant = TenantColumn()
|
|
||||||
status = columns.ChoiceFieldColumn(
|
status = columns.ChoiceFieldColumn(
|
||||||
default=AVAILABLE_LABEL
|
default=AVAILABLE_LABEL
|
||||||
)
|
)
|
||||||
@ -123,7 +122,7 @@ class VLANTable(NetBoxTable):
|
|||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = VLAN
|
model = VLAN
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'id', 'vid', 'name', 'site', 'group', 'prefixes', 'tenant', 'status', 'role', 'description', 'tags',
|
'pk', 'id', 'vid', 'name', 'site', 'group', 'prefixes', 'tenant', 'tenant_group', 'status', 'role', 'description', 'tags',
|
||||||
'created', 'last_updated',
|
'created', 'last_updated',
|
||||||
)
|
)
|
||||||
default_columns = ('pk', 'vid', 'name', 'site', 'group', 'prefixes', 'tenant', 'status', 'role', 'description')
|
default_columns = ('pk', 'vid', 'name', 'site', 'group', 'prefixes', 'tenant', 'status', 'role', 'description')
|
||||||
@ -174,7 +173,7 @@ class VLANVirtualMachinesTable(VLANMembersTable):
|
|||||||
exclude = ('id', )
|
exclude = ('id', )
|
||||||
|
|
||||||
|
|
||||||
class InterfaceVLANTable(NetBoxTable):
|
class InterfaceVLANTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
"""
|
"""
|
||||||
List VLANs assigned to a specific Interface.
|
List VLANs assigned to a specific Interface.
|
||||||
"""
|
"""
|
||||||
@ -190,7 +189,6 @@ class InterfaceVLANTable(NetBoxTable):
|
|||||||
accessor=Accessor('group__name'),
|
accessor=Accessor('group__name'),
|
||||||
verbose_name='Group'
|
verbose_name='Group'
|
||||||
)
|
)
|
||||||
tenant = TenantColumn()
|
|
||||||
status = columns.ChoiceFieldColumn()
|
status = columns.ChoiceFieldColumn()
|
||||||
role = tables.Column(
|
role = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
@ -198,7 +196,7 @@ class InterfaceVLANTable(NetBoxTable):
|
|||||||
|
|
||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = VLAN
|
model = VLAN
|
||||||
fields = ('vid', 'tagged', 'site', 'group', 'name', 'tenant', 'status', 'role', 'description')
|
fields = ('vid', 'tagged', 'site', 'group', 'name', 'tenant', 'tenant_group', 'status', 'role', 'description')
|
||||||
exclude = ('id', )
|
exclude = ('id', )
|
||||||
|
|
||||||
def __init__(self, interface, *args, **kwargs):
|
def __init__(self, interface, *args, **kwargs):
|
||||||
|
@ -2,7 +2,7 @@ import django_tables2 as tables
|
|||||||
|
|
||||||
from ipam.models import *
|
from ipam.models import *
|
||||||
from netbox.tables import NetBoxTable, columns
|
from netbox.tables import NetBoxTable, columns
|
||||||
from tenancy.tables import TenantColumn
|
from tenancy.tables import TenancyColumnsMixin
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
'RouteTargetTable',
|
'RouteTargetTable',
|
||||||
@ -20,14 +20,13 @@ VRF_TARGETS = """
|
|||||||
# VRFs
|
# VRFs
|
||||||
#
|
#
|
||||||
|
|
||||||
class VRFTable(NetBoxTable):
|
class VRFTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
rd = tables.Column(
|
rd = tables.Column(
|
||||||
verbose_name='RD'
|
verbose_name='RD'
|
||||||
)
|
)
|
||||||
tenant = TenantColumn()
|
|
||||||
enforce_unique = columns.BooleanColumn(
|
enforce_unique = columns.BooleanColumn(
|
||||||
verbose_name='Unique'
|
verbose_name='Unique'
|
||||||
)
|
)
|
||||||
@ -46,7 +45,7 @@ class VRFTable(NetBoxTable):
|
|||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = VRF
|
model = VRF
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'id', 'name', 'rd', 'tenant', 'enforce_unique', 'description', 'import_targets', 'export_targets',
|
'pk', 'id', 'name', 'rd', 'tenant', 'tenant_group', 'enforce_unique', 'description', 'import_targets', 'export_targets',
|
||||||
'tags', 'created', 'last_updated',
|
'tags', 'created', 'last_updated',
|
||||||
)
|
)
|
||||||
default_columns = ('pk', 'name', 'rd', 'tenant', 'description')
|
default_columns = ('pk', 'name', 'rd', 'tenant', 'description')
|
||||||
@ -56,16 +55,15 @@ class VRFTable(NetBoxTable):
|
|||||||
# Route targets
|
# Route targets
|
||||||
#
|
#
|
||||||
|
|
||||||
class RouteTargetTable(NetBoxTable):
|
class RouteTargetTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
tenant = TenantColumn()
|
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
url_name='ipam:vrf_list'
|
url_name='ipam:vrf_list'
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = RouteTarget
|
model = RouteTarget
|
||||||
fields = ('pk', 'id', 'name', 'tenant', 'description', 'tags', 'created', 'last_updated',)
|
fields = ('pk', 'id', 'name', 'tenant', 'tenant_group', 'description', 'tags', 'created', 'last_updated',)
|
||||||
default_columns = ('pk', 'name', 'tenant', 'description')
|
default_columns = ('pk', 'name', 'tenant', 'description')
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
|
|
||||||
from netbox.tables import NetBoxTable, columns
|
from netbox.tables import NetBoxTable, columns
|
||||||
|
from tenancy.tables import TenancyColumnsMixin
|
||||||
from virtualization.models import Cluster, ClusterGroup, ClusterType
|
from virtualization.models import Cluster, ClusterGroup, ClusterType
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
@ -56,7 +57,7 @@ class ClusterGroupTable(NetBoxTable):
|
|||||||
default_columns = ('pk', 'name', 'cluster_count', 'description')
|
default_columns = ('pk', 'name', 'cluster_count', 'description')
|
||||||
|
|
||||||
|
|
||||||
class ClusterTable(NetBoxTable):
|
class ClusterTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
@ -66,9 +67,6 @@ class ClusterTable(NetBoxTable):
|
|||||||
group = tables.Column(
|
group = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
tenant = tables.Column(
|
|
||||||
linkify=True
|
|
||||||
)
|
|
||||||
site = tables.Column(
|
site = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
@ -93,7 +91,7 @@ class ClusterTable(NetBoxTable):
|
|||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = Cluster
|
model = Cluster
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'id', 'name', 'type', 'group', 'tenant', 'site', 'comments', 'device_count', 'vm_count', 'contacts',
|
'pk', 'id', 'name', 'type', 'group', 'tenant', 'tenant_group', 'site', 'comments', 'device_count', 'vm_count', 'contacts',
|
||||||
'tags', 'created', 'last_updated',
|
'tags', 'created', 'last_updated',
|
||||||
)
|
)
|
||||||
default_columns = ('pk', 'name', 'type', 'group', 'tenant', 'site', 'device_count', 'vm_count')
|
default_columns = ('pk', 'name', 'type', 'group', 'tenant', 'site', 'device_count', 'vm_count')
|
||||||
|
@ -2,7 +2,7 @@ import django_tables2 as tables
|
|||||||
|
|
||||||
from dcim.tables.devices import BaseInterfaceTable
|
from dcim.tables.devices import BaseInterfaceTable
|
||||||
from netbox.tables import NetBoxTable, columns
|
from netbox.tables import NetBoxTable, columns
|
||||||
from tenancy.tables import TenantColumn
|
from tenancy.tables import TenancyColumnsMixin
|
||||||
from virtualization.models import VirtualMachine, VMInterface
|
from virtualization.models import VirtualMachine, VMInterface
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
@ -24,7 +24,7 @@ VMINTERFACE_BUTTONS = """
|
|||||||
# Virtual machines
|
# Virtual machines
|
||||||
#
|
#
|
||||||
|
|
||||||
class VirtualMachineTable(NetBoxTable):
|
class VirtualMachineTable(TenancyColumnsMixin, NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
order_by=('_name',),
|
order_by=('_name',),
|
||||||
linkify=True
|
linkify=True
|
||||||
@ -34,7 +34,6 @@ class VirtualMachineTable(NetBoxTable):
|
|||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
role = columns.ColoredLabelColumn()
|
role = columns.ColoredLabelColumn()
|
||||||
tenant = TenantColumn()
|
|
||||||
comments = columns.MarkdownColumn()
|
comments = columns.MarkdownColumn()
|
||||||
primary_ip4 = tables.Column(
|
primary_ip4 = tables.Column(
|
||||||
linkify=True,
|
linkify=True,
|
||||||
@ -56,7 +55,7 @@ class VirtualMachineTable(NetBoxTable):
|
|||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = VirtualMachine
|
model = VirtualMachine
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'id', 'name', 'status', 'cluster', 'role', 'tenant', 'platform', 'vcpus', 'memory', 'disk',
|
'pk', 'id', 'name', 'status', 'cluster', 'role', 'tenant', 'tenant_group', 'platform', 'vcpus', 'memory', 'disk',
|
||||||
'primary_ip4', 'primary_ip6', 'primary_ip', 'comments', 'tags', 'created', 'last_updated',
|
'primary_ip4', 'primary_ip6', 'primary_ip', 'comments', 'tags', 'created', 'last_updated',
|
||||||
)
|
)
|
||||||
default_columns = (
|
default_columns = (
|
||||||
|
Reference in New Issue
Block a user