From 24769ce127ce83214820ff4c5fb7c447d65aa4d7 Mon Sep 17 00:00:00 2001 From: Dylan Lucci <49500961+DylanLucci@users.noreply.github.com> Date: Wed, 11 Feb 2026 23:55:37 +1100 Subject: [PATCH] Closes #21266: Add installed device table columns to DeviceBay table (#21348) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Expose additional properties of the device installed in each bay as configurable table columns. - Rename `role` → `installed_role` - Rename `device_type` → `installed_device_type` - Add `installed_description`, `installed_serial`, and `installed_asset_tag` columns to `DeviceBayTable` --------- Co-authored-by: Martin Hauser --- netbox/dcim/tables/devices.py | 37 +++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/netbox/dcim/tables/devices.py b/netbox/dcim/tables/devices.py index 08cfbc92f..409a5c101 100644 --- a/netbox/dcim/tables/devices.py +++ b/netbox/dcim/tables/devices.py @@ -887,24 +887,36 @@ class DeviceBayTable(DeviceComponentTable): 'args': [Accessor('device_id')], } ) - role = columns.ColoredLabelColumn( - accessor=Accessor('installed_device__role'), - verbose_name=_('Role') - ) - device_type = tables.Column( - accessor=Accessor('installed_device__device_type'), - linkify=True, - verbose_name=_('Type') - ) status = tables.TemplateColumn( verbose_name=_('Status'), template_code=DEVICEBAY_STATUS, order_by=Accessor('installed_device__status') ) installed_device = tables.Column( - verbose_name=_('Installed device'), + verbose_name=_('Installed Device'), linkify=True ) + installed_role = columns.ColoredLabelColumn( + accessor=Accessor('installed_device__role'), + verbose_name=_('Installed Role') + ) + installed_device_type = tables.Column( + accessor=Accessor('installed_device__device_type'), + linkify=True, + verbose_name=_('Installed Type') + ) + installed_description = tables.Column( + accessor=Accessor('installed_device__description'), + verbose_name=_('Installed Description') + ) + installed_serial = tables.Column( + accessor=Accessor('installed_device__serial'), + verbose_name=_('Installed Serial') + ) + installed_asset_tag = tables.Column( + accessor=Accessor('installed_device__asset_tag'), + verbose_name=_('Installed Asset Tag') + ) tags = columns.TagColumn( url_name='dcim:devicebay_list' ) @@ -912,8 +924,9 @@ class DeviceBayTable(DeviceComponentTable): class Meta(DeviceComponentTable.Meta): model = models.DeviceBay fields = ( - 'pk', 'id', 'name', 'device', 'label', 'status', 'role', 'device_type', 'installed_device', 'description', - 'tags', 'created', 'last_updated', + 'pk', 'id', 'name', 'device', 'label', 'status', 'description', 'installed_device', 'installed_role', + 'installed_device_type', 'installed_description', 'installed_serial', 'installed_asset_tag', 'tags', + 'created', 'last_updated', ) default_columns = ('pk', 'name', 'device', 'label', 'status', 'installed_device', 'description')