mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-24 17:58:43 +02:00
Merge pull request #21816 from netbox-community/21770-embedded-table-columns
Closes #21770: Enable including/excluding columns on ObjectsTablePanel
This commit is contained in:
@@ -53,6 +53,7 @@ class ProviderView(GetRelatedModelsMixin, generic.ObjectView):
|
|||||||
ObjectsTablePanel(
|
ObjectsTablePanel(
|
||||||
model='circuits.ProviderAccount',
|
model='circuits.ProviderAccount',
|
||||||
filters={'provider_id': lambda ctx: ctx['object'].pk},
|
filters={'provider_id': lambda ctx: ctx['object'].pk},
|
||||||
|
exclude_columns=['provider'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject(
|
actions.AddObject(
|
||||||
'circuits.ProviderAccount', url_params={'provider': lambda ctx: ctx['object'].pk}
|
'circuits.ProviderAccount', url_params={'provider': lambda ctx: ctx['object'].pk}
|
||||||
@@ -62,6 +63,7 @@ class ProviderView(GetRelatedModelsMixin, generic.ObjectView):
|
|||||||
ObjectsTablePanel(
|
ObjectsTablePanel(
|
||||||
model='circuits.Circuit',
|
model='circuits.Circuit',
|
||||||
filters={'provider_id': lambda ctx: ctx['object'].pk},
|
filters={'provider_id': lambda ctx: ctx['object'].pk},
|
||||||
|
exclude_columns=['provider'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject('circuits.Circuit', url_params={'provider': lambda ctx: ctx['object'].pk}),
|
actions.AddObject('circuits.Circuit', url_params={'provider': lambda ctx: ctx['object'].pk}),
|
||||||
],
|
],
|
||||||
@@ -161,6 +163,7 @@ class ProviderAccountView(GetRelatedModelsMixin, generic.ObjectView):
|
|||||||
ObjectsTablePanel(
|
ObjectsTablePanel(
|
||||||
model='circuits.Circuit',
|
model='circuits.Circuit',
|
||||||
filters={'provider_account_id': lambda ctx: ctx['object'].pk},
|
filters={'provider_account_id': lambda ctx: ctx['object'].pk},
|
||||||
|
exclude_columns=['provider_account'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject(
|
actions.AddObject(
|
||||||
'circuits.Circuit',
|
'circuits.Circuit',
|
||||||
@@ -257,6 +260,7 @@ class ProviderNetworkView(GetRelatedModelsMixin, generic.ObjectView):
|
|||||||
ObjectsTablePanel(
|
ObjectsTablePanel(
|
||||||
model='circuits.VirtualCircuit',
|
model='circuits.VirtualCircuit',
|
||||||
filters={'provider_network_id': lambda ctx: ctx['object'].pk},
|
filters={'provider_network_id': lambda ctx: ctx['object'].pk},
|
||||||
|
exclude_columns=['provider_network'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject(
|
actions.AddObject(
|
||||||
'circuits.VirtualCircuit', url_params={'provider_network': lambda ctx: ctx['object'].pk}
|
'circuits.VirtualCircuit', url_params={'provider_network': lambda ctx: ctx['object'].pk}
|
||||||
@@ -801,6 +805,7 @@ class VirtualCircuitView(generic.ObjectView):
|
|||||||
model='circuits.VirtualCircuitTermination',
|
model='circuits.VirtualCircuitTermination',
|
||||||
title=_('Terminations'),
|
title=_('Terminations'),
|
||||||
filters={'virtual_circuit_id': lambda ctx: ctx['object'].pk},
|
filters={'virtual_circuit_id': lambda ctx: ctx['object'].pk},
|
||||||
|
exclude_columns=['virtual_circuit'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject(
|
actions.AddObject(
|
||||||
'circuits.VirtualCircuitTermination',
|
'circuits.VirtualCircuitTermination',
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ class DataSourceView(GetRelatedModelsMixin, generic.ObjectView):
|
|||||||
ObjectsTablePanel(
|
ObjectsTablePanel(
|
||||||
model='core.DataFile',
|
model='core.DataFile',
|
||||||
filters={'source_id': lambda ctx: ctx['object'].pk},
|
filters={'source_id': lambda ctx: ctx['object'].pk},
|
||||||
|
exclude_columns=['source'],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -258,6 +258,7 @@ class RegionView(GetRelatedModelsMixin, generic.ObjectView):
|
|||||||
model='dcim.Region',
|
model='dcim.Region',
|
||||||
title=_('Child Regions'),
|
title=_('Child Regions'),
|
||||||
filters={'parent_id': lambda ctx: ctx['object'].pk},
|
filters={'parent_id': lambda ctx: ctx['object'].pk},
|
||||||
|
exclude_columns=['parent'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject('dcim.Region', url_params={'parent': lambda ctx: ctx['object'].pk}),
|
actions.AddObject('dcim.Region', url_params={'parent': lambda ctx: ctx['object'].pk}),
|
||||||
],
|
],
|
||||||
@@ -390,6 +391,7 @@ class SiteGroupView(GetRelatedModelsMixin, generic.ObjectView):
|
|||||||
model='dcim.SiteGroup',
|
model='dcim.SiteGroup',
|
||||||
title=_('Child Groups'),
|
title=_('Child Groups'),
|
||||||
filters={'parent_id': lambda ctx: ctx['object'].pk},
|
filters={'parent_id': lambda ctx: ctx['object'].pk},
|
||||||
|
exclude_columns=['parent'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject('dcim.SiteGroup', url_params={'parent': lambda ctx: ctx['object'].pk}),
|
actions.AddObject('dcim.SiteGroup', url_params={'parent': lambda ctx: ctx['object'].pk}),
|
||||||
],
|
],
|
||||||
@@ -540,6 +542,7 @@ class SiteView(GetRelatedModelsMixin, generic.ObjectView):
|
|||||||
ObjectsTablePanel(
|
ObjectsTablePanel(
|
||||||
model='dcim.Location',
|
model='dcim.Location',
|
||||||
filters={'site_id': lambda ctx: ctx['object'].pk},
|
filters={'site_id': lambda ctx: ctx['object'].pk},
|
||||||
|
exclude_columns=['site'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject('dcim.Location', url_params={'site': lambda ctx: ctx['object'].pk}),
|
actions.AddObject('dcim.Location', url_params={'site': lambda ctx: ctx['object'].pk}),
|
||||||
],
|
],
|
||||||
@@ -552,6 +555,7 @@ class SiteView(GetRelatedModelsMixin, generic.ObjectView):
|
|||||||
'rack_id': settings.FILTERS_NULL_CHOICE_VALUE,
|
'rack_id': settings.FILTERS_NULL_CHOICE_VALUE,
|
||||||
'parent_bay_id': settings.FILTERS_NULL_CHOICE_VALUE,
|
'parent_bay_id': settings.FILTERS_NULL_CHOICE_VALUE,
|
||||||
},
|
},
|
||||||
|
exclude_columns=['site'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject('dcim.Device', url_params={'site': lambda ctx: ctx['object'].pk}),
|
actions.AddObject('dcim.Device', url_params={'site': lambda ctx: ctx['object'].pk}),
|
||||||
],
|
],
|
||||||
@@ -674,6 +678,7 @@ class LocationView(GetRelatedModelsMixin, generic.ObjectView):
|
|||||||
model='dcim.Location',
|
model='dcim.Location',
|
||||||
title=_('Child Locations'),
|
title=_('Child Locations'),
|
||||||
filters={'parent_id': lambda ctx: ctx['object'].pk},
|
filters={'parent_id': lambda ctx: ctx['object'].pk},
|
||||||
|
exclude_columns=['parent'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject(
|
actions.AddObject(
|
||||||
'dcim.Location',
|
'dcim.Location',
|
||||||
@@ -692,6 +697,7 @@ class LocationView(GetRelatedModelsMixin, generic.ObjectView):
|
|||||||
'rack_id': settings.FILTERS_NULL_CHOICE_VALUE,
|
'rack_id': settings.FILTERS_NULL_CHOICE_VALUE,
|
||||||
'parent_bay_id': settings.FILTERS_NULL_CHOICE_VALUE,
|
'parent_bay_id': settings.FILTERS_NULL_CHOICE_VALUE,
|
||||||
},
|
},
|
||||||
|
exclude_columns=['location'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject(
|
actions.AddObject(
|
||||||
'dcim.Device',
|
'dcim.Device',
|
||||||
@@ -1686,6 +1692,7 @@ class ModuleTypeProfileView(generic.ObjectView):
|
|||||||
filters={
|
filters={
|
||||||
'profile_id': lambda ctx: ctx['object'].pk,
|
'profile_id': lambda ctx: ctx['object'].pk,
|
||||||
},
|
},
|
||||||
|
exclude_columns=['profile'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject(
|
actions.AddObject(
|
||||||
'dcim.ModuleType',
|
'dcim.ModuleType',
|
||||||
@@ -2427,6 +2434,7 @@ class DeviceRoleView(GetRelatedModelsMixin, generic.ObjectView):
|
|||||||
model='dcim.DeviceRole',
|
model='dcim.DeviceRole',
|
||||||
title=_('Child Device Roles'),
|
title=_('Child Device Roles'),
|
||||||
filters={'parent_id': lambda ctx: ctx['object'].pk},
|
filters={'parent_id': lambda ctx: ctx['object'].pk},
|
||||||
|
exclude_columns=['parent'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject('dcim.DeviceRole', url_params={'parent': lambda ctx: ctx['object'].pk}),
|
actions.AddObject('dcim.DeviceRole', url_params={'parent': lambda ctx: ctx['object'].pk}),
|
||||||
],
|
],
|
||||||
@@ -2527,6 +2535,7 @@ class PlatformView(GetRelatedModelsMixin, generic.ObjectView):
|
|||||||
model='dcim.Platform',
|
model='dcim.Platform',
|
||||||
title=_('Child Platforms'),
|
title=_('Child Platforms'),
|
||||||
filters={'parent_id': lambda ctx: ctx['object'].pk},
|
filters={'parent_id': lambda ctx: ctx['object'].pk},
|
||||||
|
exclude_columns=['parent'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject('dcim.Platform', url_params={'parent': lambda ctx: ctx['object'].pk}),
|
actions.AddObject('dcim.Platform', url_params={'parent': lambda ctx: ctx['object'].pk}),
|
||||||
],
|
],
|
||||||
@@ -2605,6 +2614,7 @@ class DeviceView(generic.ObjectView):
|
|||||||
ObjectsTablePanel(
|
ObjectsTablePanel(
|
||||||
model='dcim.VirtualDeviceContext',
|
model='dcim.VirtualDeviceContext',
|
||||||
filters={'device_id': lambda ctx: ctx['object'].pk},
|
filters={'device_id': lambda ctx: ctx['object'].pk},
|
||||||
|
exclude_columns=['device'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject('dcim.VirtualDeviceContext', url_params={'device': lambda ctx: ctx['object'].pk}),
|
actions.AddObject('dcim.VirtualDeviceContext', url_params={'device': lambda ctx: ctx['object'].pk}),
|
||||||
],
|
],
|
||||||
@@ -2617,6 +2627,7 @@ class DeviceView(generic.ObjectView):
|
|||||||
model='ipam.Service',
|
model='ipam.Service',
|
||||||
title=_('Application Services'),
|
title=_('Application Services'),
|
||||||
filters={'device_id': lambda ctx: ctx['object'].pk},
|
filters={'device_id': lambda ctx: ctx['object'].pk},
|
||||||
|
exclude_columns=['parent'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject(
|
actions.AddObject(
|
||||||
'ipam.Service',
|
'ipam.Service',
|
||||||
@@ -3376,11 +3387,13 @@ class InterfaceView(generic.ObjectView):
|
|||||||
model='ipam.IPAddress',
|
model='ipam.IPAddress',
|
||||||
filters={'interface_id': lambda ctx: ctx['object'].pk},
|
filters={'interface_id': lambda ctx: ctx['object'].pk},
|
||||||
title=_('IP Addresses'),
|
title=_('IP Addresses'),
|
||||||
|
exclude_columns=['assigned', 'assigned_object', 'assigned_object_parent'],
|
||||||
),
|
),
|
||||||
ObjectsTablePanel(
|
ObjectsTablePanel(
|
||||||
model='dcim.MACAddress',
|
model='dcim.MACAddress',
|
||||||
filters={'interface_id': lambda ctx: ctx['object'].pk},
|
filters={'interface_id': lambda ctx: ctx['object'].pk},
|
||||||
title=_('MAC Addresses'),
|
title=_('MAC Addresses'),
|
||||||
|
exclude_columns=['assigned_object', 'assigned_object_parent'],
|
||||||
),
|
),
|
||||||
ObjectsTablePanel(
|
ObjectsTablePanel(
|
||||||
model='ipam.VLAN',
|
model='ipam.VLAN',
|
||||||
|
|||||||
@@ -1331,6 +1331,7 @@ class VLANTranslationPolicyView(generic.ObjectView):
|
|||||||
'ipam.vlantranslationrule',
|
'ipam.vlantranslationrule',
|
||||||
filters={'policy_id': lambda ctx: ctx['object'].pk},
|
filters={'policy_id': lambda ctx: ctx['object'].pk},
|
||||||
title=_('VLAN translation rules'),
|
title=_('VLAN translation rules'),
|
||||||
|
exclude_columns=['policy'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject(
|
actions.AddObject(
|
||||||
'ipam.vlantranslationrule',
|
'ipam.vlantranslationrule',
|
||||||
@@ -1628,6 +1629,7 @@ class VLANView(generic.ObjectView):
|
|||||||
'ipam.prefix',
|
'ipam.prefix',
|
||||||
filters={'vlan_id': lambda ctx: ctx['object'].pk},
|
filters={'vlan_id': lambda ctx: ctx['object'].pk},
|
||||||
title=_('Prefixes'),
|
title=_('Prefixes'),
|
||||||
|
exclude_columns=['vlan'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject(
|
actions.AddObject(
|
||||||
'ipam.prefix',
|
'ipam.prefix',
|
||||||
|
|||||||
@@ -185,6 +185,18 @@ class BaseTable(tables.Table):
|
|||||||
columns = getattr(self.Meta, 'default_columns', self.Meta.fields)
|
columns = getattr(self.Meta, 'default_columns', self.Meta.fields)
|
||||||
|
|
||||||
self._set_columns(columns)
|
self._set_columns(columns)
|
||||||
|
|
||||||
|
# Apply column inclusion/exclusion (overrides user preferences)
|
||||||
|
if columns_param := request.GET.get('include_columns'):
|
||||||
|
for column_name in columns_param.split(','):
|
||||||
|
if column_name in self.columns.names():
|
||||||
|
self.columns.show(column_name)
|
||||||
|
if exclude_columns := request.GET.get('exclude_columns'):
|
||||||
|
exclude_columns = exclude_columns.split(',')
|
||||||
|
for column_name in exclude_columns:
|
||||||
|
if column_name in self.columns.names() and column_name not in self.exempt_columns:
|
||||||
|
self.columns.hide(column_name)
|
||||||
|
|
||||||
self._apply_prefetching()
|
self._apply_prefetching()
|
||||||
if ordering is not None:
|
if ordering is not None:
|
||||||
self.order_by = ordering
|
self.order_by = ordering
|
||||||
|
|||||||
@@ -282,11 +282,13 @@ class ObjectsTablePanel(Panel):
|
|||||||
model (str): The dotted label of the model to be added (e.g. "dcim.site")
|
model (str): The dotted label of the model to be added (e.g. "dcim.site")
|
||||||
filters (dict): A dictionary of arbitrary URL parameters to append to the table's URL. If the value of a key is
|
filters (dict): A dictionary of arbitrary URL parameters to append to the table's URL. If the value of a key is
|
||||||
a callable, it will be passed the current template context.
|
a callable, it will be passed the current template context.
|
||||||
|
include_columns (list): A list of column names to always display (overrides user preferences)
|
||||||
|
exclude_columns (list): A list of column names to hide from the table (overrides user preferences)
|
||||||
"""
|
"""
|
||||||
template_name = 'ui/panels/objects_table.html'
|
template_name = 'ui/panels/objects_table.html'
|
||||||
title = None
|
title = None
|
||||||
|
|
||||||
def __init__(self, model, filters=None, **kwargs):
|
def __init__(self, model, filters=None, include_columns=None, exclude_columns=None, **kwargs):
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
# Resolve the model class from its app.name label
|
# Resolve the model class from its app.name label
|
||||||
@@ -297,6 +299,8 @@ class ObjectsTablePanel(Panel):
|
|||||||
raise ValueError(f"Invalid model label: {model}")
|
raise ValueError(f"Invalid model label: {model}")
|
||||||
|
|
||||||
self.filters = filters or {}
|
self.filters = filters or {}
|
||||||
|
self.include_columns = include_columns or []
|
||||||
|
self.exclude_columns = exclude_columns or []
|
||||||
|
|
||||||
# If no title is specified, derive one from the model name
|
# If no title is specified, derive one from the model name
|
||||||
if self.title is None:
|
if self.title is None:
|
||||||
@@ -308,6 +312,10 @@ class ObjectsTablePanel(Panel):
|
|||||||
}
|
}
|
||||||
if 'return_url' not in url_params and 'object' in context:
|
if 'return_url' not in url_params and 'object' in context:
|
||||||
url_params['return_url'] = context['object'].get_absolute_url()
|
url_params['return_url'] = context['object'].get_absolute_url()
|
||||||
|
if self.include_columns:
|
||||||
|
url_params['include_columns'] = ','.join(self.include_columns)
|
||||||
|
if self.exclude_columns:
|
||||||
|
url_params['exclude_columns'] = ','.join(self.exclude_columns)
|
||||||
return {
|
return {
|
||||||
**super().get_context(context),
|
**super().get_context(context),
|
||||||
'viewname': get_viewname(self.model, 'list'),
|
'viewname': get_viewname(self.model, 'list'),
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ class TenantGroupView(GetRelatedModelsMixin, generic.ObjectView):
|
|||||||
'tenancy.tenantgroup',
|
'tenancy.tenantgroup',
|
||||||
filters={'parent_id': lambda ctx: ctx['object'].pk},
|
filters={'parent_id': lambda ctx: ctx['object'].pk},
|
||||||
title=_('Child Groups'),
|
title=_('Child Groups'),
|
||||||
|
exclude_columns=['parent'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject(
|
actions.AddObject(
|
||||||
'tenancy.tenantgroup',
|
'tenancy.tenantgroup',
|
||||||
@@ -235,6 +236,7 @@ class ContactGroupView(GetRelatedModelsMixin, generic.ObjectView):
|
|||||||
'tenancy.contactgroup',
|
'tenancy.contactgroup',
|
||||||
filters={'parent_id': lambda ctx: ctx['object'].pk},
|
filters={'parent_id': lambda ctx: ctx['object'].pk},
|
||||||
title=_('Child Groups'),
|
title=_('Child Groups'),
|
||||||
|
exclude_columns=['parent'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject(
|
actions.AddObject(
|
||||||
'tenancy.contactgroup',
|
'tenancy.contactgroup',
|
||||||
@@ -414,6 +416,7 @@ class ContactView(generic.ObjectView):
|
|||||||
'tenancy.contactassignment',
|
'tenancy.contactassignment',
|
||||||
filters={'contact_id': lambda ctx: ctx['object'].pk},
|
filters={'contact_id': lambda ctx: ctx['object'].pk},
|
||||||
title=_('Assignments'),
|
title=_('Assignments'),
|
||||||
|
exclude_columns=['contact'],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -200,7 +200,10 @@ class GroupView(generic.ObjectView):
|
|||||||
OrganizationalObjectPanel(),
|
OrganizationalObjectPanel(),
|
||||||
],
|
],
|
||||||
right_panels=[
|
right_panels=[
|
||||||
ObjectsTablePanel('users.User', filters={'group_id': lambda ctx: ctx['object'].pk}),
|
ObjectsTablePanel(
|
||||||
|
'users.User',
|
||||||
|
filters={'group_id': lambda ctx: ctx['object'].pk},
|
||||||
|
),
|
||||||
ObjectsTablePanel(
|
ObjectsTablePanel(
|
||||||
'users.ObjectPermission',
|
'users.ObjectPermission',
|
||||||
title=_('Assigned Permissions'),
|
title=_('Assigned Permissions'),
|
||||||
@@ -345,6 +348,7 @@ class OwnerGroupView(generic.ObjectView):
|
|||||||
'users.Owner',
|
'users.Owner',
|
||||||
filters={'group_id': lambda ctx: ctx['object'].pk},
|
filters={'group_id': lambda ctx: ctx['object'].pk},
|
||||||
title=_('Members'),
|
title=_('Members'),
|
||||||
|
exclude_columns=['group'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject(
|
actions.AddObject(
|
||||||
'users.Owner',
|
'users.Owner',
|
||||||
@@ -412,8 +416,14 @@ class OwnerView(GetRelatedModelsMixin, generic.ObjectView):
|
|||||||
layout = layout.SimpleLayout(
|
layout = layout.SimpleLayout(
|
||||||
left_panels=[
|
left_panels=[
|
||||||
panels.OwnerPanel(),
|
panels.OwnerPanel(),
|
||||||
ObjectsTablePanel('users.Group', filters={'owner_id': lambda ctx: ctx['object'].pk}),
|
ObjectsTablePanel(
|
||||||
ObjectsTablePanel('users.User', filters={'owner_id': lambda ctx: ctx['object'].pk}),
|
'users.Group',
|
||||||
|
filters={'owner_id': lambda ctx: ctx['object'].pk},
|
||||||
|
),
|
||||||
|
ObjectsTablePanel(
|
||||||
|
'users.User',
|
||||||
|
filters={'owner_id': lambda ctx: ctx['object'].pk},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
right_panels=[
|
right_panels=[
|
||||||
RelatedObjectsPanel(),
|
RelatedObjectsPanel(),
|
||||||
|
|||||||
@@ -492,6 +492,7 @@ class VirtualMachineView(generic.ObjectView):
|
|||||||
model='ipam.Service',
|
model='ipam.Service',
|
||||||
title=_('Application Services'),
|
title=_('Application Services'),
|
||||||
filters={'virtual_machine_id': lambda ctx: ctx['object'].pk},
|
filters={'virtual_machine_id': lambda ctx: ctx['object'].pk},
|
||||||
|
exclude_columns=['parent'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject(
|
actions.AddObject(
|
||||||
'ipam.Service',
|
'ipam.Service',
|
||||||
@@ -508,6 +509,7 @@ class VirtualMachineView(generic.ObjectView):
|
|||||||
ObjectsTablePanel(
|
ObjectsTablePanel(
|
||||||
model='virtualization.VirtualDisk',
|
model='virtualization.VirtualDisk',
|
||||||
filters={'virtual_machine_id': lambda ctx: ctx['object'].pk},
|
filters={'virtual_machine_id': lambda ctx: ctx['object'].pk},
|
||||||
|
exclude_columns=['virtual_machine'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject(
|
actions.AddObject(
|
||||||
'virtualization.VirtualDisk', url_params={'virtual_machine': lambda ctx: ctx['object'].pk}
|
'virtualization.VirtualDisk', url_params={'virtual_machine': lambda ctx: ctx['object'].pk}
|
||||||
@@ -649,6 +651,7 @@ class VMInterfaceView(generic.ObjectView):
|
|||||||
ObjectsTablePanel(
|
ObjectsTablePanel(
|
||||||
model='ipam.IPaddress',
|
model='ipam.IPaddress',
|
||||||
filters={'vminterface_id': lambda ctx: ctx['object'].pk},
|
filters={'vminterface_id': lambda ctx: ctx['object'].pk},
|
||||||
|
exclude_columns=['assigned', 'assigned_object', 'assigned_object_parent'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject(
|
actions.AddObject(
|
||||||
'ipam.IPaddress',
|
'ipam.IPaddress',
|
||||||
@@ -662,6 +665,7 @@ class VMInterfaceView(generic.ObjectView):
|
|||||||
ObjectsTablePanel(
|
ObjectsTablePanel(
|
||||||
model='dcim.MACAddress',
|
model='dcim.MACAddress',
|
||||||
filters={'vminterface_id': lambda ctx: ctx['object'].pk},
|
filters={'vminterface_id': lambda ctx: ctx['object'].pk},
|
||||||
|
exclude_columns=['assigned_object', 'assigned_object_parent'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject(
|
actions.AddObject(
|
||||||
'dcim.MACAddress', url_params={'vminterface': lambda ctx: ctx['object'].pk}
|
'dcim.MACAddress', url_params={'vminterface': lambda ctx: ctx['object'].pk}
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ class TunnelView(generic.ObjectView):
|
|||||||
ObjectsTablePanel(
|
ObjectsTablePanel(
|
||||||
'vpn.tunneltermination',
|
'vpn.tunneltermination',
|
||||||
filters={'tunnel_id': lambda ctx: ctx['object'].pk},
|
filters={'tunnel_id': lambda ctx: ctx['object'].pk},
|
||||||
|
exclude_columns=['tunnel'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject(
|
actions.AddObject(
|
||||||
'vpn.tunneltermination',
|
'vpn.tunneltermination',
|
||||||
@@ -223,6 +224,7 @@ class TunnelTerminationView(generic.ObjectView):
|
|||||||
'tunnel_id': lambda ctx: ctx['object'].tunnel.pk,
|
'tunnel_id': lambda ctx: ctx['object'].tunnel.pk,
|
||||||
'id__n': lambda ctx: ctx['object'].pk,
|
'id__n': lambda ctx: ctx['object'].pk,
|
||||||
},
|
},
|
||||||
|
exclude_columns=['tunnel'],
|
||||||
title=_('Peer Terminations'),
|
title=_('Peer Terminations'),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -675,6 +677,7 @@ class L2VPNView(generic.ObjectView):
|
|||||||
ObjectsTablePanel(
|
ObjectsTablePanel(
|
||||||
'vpn.l2vpntermination',
|
'vpn.l2vpntermination',
|
||||||
filters={'l2vpn_id': lambda ctx: ctx['object'].pk},
|
filters={'l2vpn_id': lambda ctx: ctx['object'].pk},
|
||||||
|
exclude_columns=['l2vpn'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject(
|
actions.AddObject(
|
||||||
'vpn.l2vpntermination',
|
'vpn.l2vpntermination',
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ class WirelessLANGroupView(GetRelatedModelsMixin, generic.ObjectView):
|
|||||||
model='wireless.WirelessLANGroup',
|
model='wireless.WirelessLANGroup',
|
||||||
title=_('Child Groups'),
|
title=_('Child Groups'),
|
||||||
filters={'parent_id': lambda ctx: ctx['object'].pk},
|
filters={'parent_id': lambda ctx: ctx['object'].pk},
|
||||||
|
exclude_columns=['parent'],
|
||||||
actions=[
|
actions=[
|
||||||
actions.AddObject(
|
actions.AddObject(
|
||||||
'wireless.WirelessLANGroup',
|
'wireless.WirelessLANGroup',
|
||||||
|
|||||||
Reference in New Issue
Block a user