diff --git a/netbox/dcim/ui/panels.py b/netbox/dcim/ui/panels.py index c6122de2e..a25ad11ce 100644 --- a/netbox/dcim/ui/panels.py +++ b/netbox/dcim/ui/panels.py @@ -166,6 +166,11 @@ class ModuleTypePanel(panels.ObjectAttributesPanel): weight = attrs.NumericAttr('weight', unit_accessor='get_weight_unit_display') +class PlatformPanel(panels.NestedGroupObjectPanel): + manufacturer = attrs.RelatedObjectAttr('manufacturer', linkify=True) + config_template = attrs.RelatedObjectAttr('config_template', linkify=True) + + class VirtualChassisMembersPanel(panels.ObjectPanel): """ A panel which lists all members of a virtual chassis. diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index 4a320a275..a948f098e 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -2410,6 +2410,27 @@ class PlatformListView(generic.ObjectListView): @register_model_view(Platform) class PlatformView(GetRelatedModelsMixin, generic.ObjectView): queryset = Platform.objects.all() + layout = layout.SimpleLayout( + left_panels=[ + panels.PlatformPanel(), + TagsPanel(), + ], + right_panels=[ + RelatedObjectsPanel(), + CustomFieldsPanel(), + CommentsPanel(), + ], + bottom_panels=[ + ObjectsTablePanel( + model='dcim.Platform', + title=_('Child Platforms'), + filters={'parent_id': lambda ctx: ctx['object'].pk}, + actions=[ + actions.AddObject('dcim.Platform', url_params={'parent': lambda ctx: ctx['object'].pk}), + ], + ), + ] + ) def get_extra_context(self, request, instance): return { diff --git a/netbox/templates/dcim/platform.html b/netbox/templates/dcim/platform.html index 4becc042b..26179d4a2 100644 --- a/netbox/templates/dcim/platform.html +++ b/netbox/templates/dcim/platform.html @@ -18,61 +18,3 @@ {% endif %} {% endblock extra_controls %} - -{% block content %} -
| {% trans "Name" %} | -{{ object.name }} | -
|---|---|
| {% trans "Description" %} | -{{ object.description|placeholder }} | -
| {% trans "Parent" %} | -{{ object.parent|linkify|placeholder }} | -
| {% trans "Manufacturer" %} | -{{ object.manufacturer|linkify|placeholder }} | -
| {% trans "Config Template" %} | -{{ object.config_template|linkify|placeholder }} | -