diff --git a/netbox/dcim/ui/panels.py b/netbox/dcim/ui/panels.py
index 87ceb9c4a..6d0270e25 100644
--- a/netbox/dcim/ui/panels.py
+++ b/netbox/dcim/ui/panels.py
@@ -150,6 +150,16 @@ class ModuleTypeProfilePanel(panels.ObjectAttributesPanel):
description = attrs.TextAttr('description')
+class ModuleTypePanel(panels.ObjectAttributesPanel):
+ profile = attrs.RelatedObjectAttr('profile', linkify=True)
+ manufacturer = attrs.RelatedObjectAttr('manufacturer', linkify=True)
+ model = attrs.TextAttr('name')
+ part_number = attrs.TextAttr('part_number')
+ description = attrs.TextAttr('description')
+ airflow = attrs.ChoiceAttr('airflow')
+ weight = attrs.NumericAttr('weight', unit_accessor='get_weight_unit_display')
+
+
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 ba9365c83..84b14be1c 100644
--- a/netbox/dcim/views.py
+++ b/netbox/dcim/views.py
@@ -21,8 +21,8 @@ from ipam.tables import InterfaceVLANTable, VLANTranslationRuleTable
from netbox.object_actions import *
from netbox.ui import actions, layout
from netbox.ui.panels import (
- CommentsPanel, JSONPanel, NestedGroupObjectPanel, ObjectsTablePanel, OrganizationalObjectPanel, RelatedObjectsPanel,
- TemplatePanel,
+ CommentsPanel, JSONPanel, NestedGroupObjectPanel, ObjectsTablePanel, OrganizationalObjectPanel, Panel,
+ RelatedObjectsPanel, TemplatePanel,
)
from netbox.views import generic
from utilities.forms import ConfirmationForm
@@ -1656,6 +1656,22 @@ class ModuleTypeListView(generic.ObjectListView):
@register_model_view(ModuleType)
class ModuleTypeView(GetRelatedModelsMixin, generic.ObjectView):
queryset = ModuleType.objects.all()
+ layout = layout.SimpleLayout(
+ left_panels=[
+ panels.ModuleTypePanel(),
+ TagsPanel(),
+ CommentsPanel(),
+ ],
+ right_panels=[
+ Panel(
+ title=_('Attributes'),
+ template_name='dcim/panels/module_type_attributes.html',
+ ),
+ RelatedObjectsPanel(),
+ CustomFieldsPanel(),
+ ImageAttachmentsPanel(),
+ ],
+ )
def get_extra_context(self, request, instance):
return {
diff --git a/netbox/templates/dcim/moduletype.html b/netbox/templates/dcim/moduletype.html
index 691ff1636..d782c1c27 100644
--- a/netbox/templates/dcim/moduletype.html
+++ b/netbox/templates/dcim/moduletype.html
@@ -1,7 +1,4 @@
{% extends 'generic/object.html' %}
-{% load buttons %}
-{% load helpers %}
-{% load plugins %}
{% load i18n %}
{% block title %}{{ object.manufacturer }} {{ object.model }}{% endblock %}
@@ -14,92 +11,5 @@
{% endblock %}
{% block extra_controls %}
- {% include 'dcim/inc/moduletype_buttons.html' %}
-{% endblock %}
-
-{% block content %}
-
-
-
-
-
-
- | {% trans "Profile" %} |
- {{ object.profile|linkify|placeholder }} |
-
-
- | {% trans "Manufacturer" %} |
- {{ object.manufacturer|linkify }} |
-
-
- | {% trans "Model Name" %} |
- {{ object.model }} |
-
-
- | {% trans "Part Number" %} |
- {{ object.part_number|placeholder }} |
-
-
- | {% trans "Description" %} |
- {{ object.description|placeholder }} |
-
-
- | {% trans "Airflow" %} |
- {{ object.get_airflow_display|placeholder }} |
-
-
- | {% trans "Weight" %} |
-
- {% if object.weight %}
- {{ object.weight|floatformat }} {{ object.get_weight_unit_display }}
- {% else %}
- {{ ''|placeholder }}
- {% endif %}
- |
-
-
-
- {% include 'inc/panels/tags.html' %}
- {% include 'inc/panels/comments.html' %}
- {% plugin_left_page object %}
-
-
-
-
- {% if not object.profile %}
-
- {% trans "No profile assigned" %}
-
- {% elif object.attributes %}
-
- {% for k, v in object.attributes.items %}
-
- | {{ k }} |
-
- {% if v is True or v is False %}
- {% checkmark v %}
- {% else %}
- {{ v|placeholder }}
- {% endif %}
- |
-
- {% endfor %}
-
- {% else %}
-
- {% trans "None" %}
-
- {% endif %}
-
- {% include 'inc/panels/related_objects.html' %}
- {% include 'inc/panels/custom_fields.html' %}
- {% include 'inc/panels/image_attachments.html' %}
- {% plugin_right_page object %}
-
-
-
-
- {% plugin_full_width_page object %}
-
-
+ {% include 'dcim/inc/moduletype_buttons.html' %}
{% endblock %}
diff --git a/netbox/templates/dcim/panels/module_type_attributes.html b/netbox/templates/dcim/panels/module_type_attributes.html
new file mode 100644
index 000000000..85907686d
--- /dev/null
+++ b/netbox/templates/dcim/panels/module_type_attributes.html
@@ -0,0 +1,29 @@
+{% extends "ui/panels/_base.html" %}
+{% load helpers i18n %}
+
+{% block panel_content %}
+ {% if not object.profile %}
+
+ {% trans "No profile assigned" %}
+
+ {% elif object.attributes %}
+
+ {% for k, v in object.attributes.items %}
+
+ | {{ k }} |
+
+ {% if v is True or v is False %}
+ {% checkmark v %}
+ {% else %}
+ {{ v|placeholder }}
+ {% endif %}
+ |
+
+ {% endfor %}
+
+ {% else %}
+
+ {% trans "None" %}
+
+ {% endif %}
+{% endblock panel_content %}