mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-21 00:11:39 +02:00
* Use MPTTColumn for module bays * Fix return URLs * Omit extraneous relationships from nested serializers * Add note re: v4.1
This commit is contained in:
@@ -299,7 +299,7 @@ class ModuleBaySerializer(NetBoxModelSerializer):
|
||||
device = DeviceSerializer(nested=True)
|
||||
module = ModuleSerializer(
|
||||
nested=True,
|
||||
fields=('id', 'url', 'display', 'module_bay'),
|
||||
fields=('id', 'url', 'display'),
|
||||
required=False,
|
||||
allow_null=True,
|
||||
default=None
|
||||
|
||||
@@ -91,8 +91,7 @@ class ModuleBayNestedModuleSerializer(WritableNestedSerializer):
|
||||
|
||||
|
||||
class NestedModuleBaySerializer(WritableNestedSerializer):
|
||||
installed_module = ModuleBayNestedModuleSerializer(required=False, allow_null=True)
|
||||
|
||||
class Meta:
|
||||
model = models.ModuleBay
|
||||
fields = ['id', 'url', 'display_url', 'display', 'installed_module', 'name']
|
||||
fields = ['id', 'url', 'display_url', 'display', 'name']
|
||||
|
||||
@@ -903,12 +903,10 @@ class ModuleBayTable(ModularDeviceComponentTable):
|
||||
|
||||
|
||||
class DeviceModuleBayTable(ModuleBayTable):
|
||||
name = tables.TemplateColumn(
|
||||
name = columns.MPTTColumn(
|
||||
verbose_name=_('Name'),
|
||||
template_code='<a href="{{ record.get_absolute_url }}" style="padding-left: {{ record.level }}0px">'
|
||||
'{{ value }}</a>',
|
||||
order_by=Accessor('_name'),
|
||||
attrs={'td': {'class': 'text-nowrap'}}
|
||||
linkify=True,
|
||||
order_by=Accessor('_name')
|
||||
)
|
||||
actions = columns.ActionsColumn(
|
||||
extra_buttons=MODULEBAY_BUTTONS
|
||||
|
||||
Reference in New Issue
Block a user