Remove obsolete template HTML

This commit is contained in:
Jeremy Stretch
2025-11-07 16:24:45 -05:00
parent 917280d1d3
commit 7b0e8c1a0d
17 changed files with 36 additions and 1285 deletions

View File

@@ -6,6 +6,7 @@ from netbox.ui import attrs, panels
class SitePanel(panels.ObjectAttributesPanel):
region = attrs.NestedObjectAttr('region', linkify=True)
group = attrs.NestedObjectAttr('group', linkify=True)
name = attrs.TextAttr('name')
status = attrs.ChoiceAttr('status')
tenant = attrs.RelatedObjectAttr('tenant', linkify=True, grouped_by='group')
facility = attrs.TextAttr('facility')
@@ -42,7 +43,8 @@ class RackPanel(panels.ObjectAttributesPanel):
region = attrs.NestedObjectAttr('site.region', linkify=True)
site = attrs.RelatedObjectAttr('site', linkify=True, grouped_by='group')
location = attrs.NestedObjectAttr('location', linkify=True)
facility = attrs.TextAttr('facility')
name = attrs.TextAttr('name')
facility = attrs.TextAttr('facility', label=_('Facility ID'))
tenant = attrs.RelatedObjectAttr('tenant', linkify=True, grouped_by='group')
status = attrs.ChoiceAttr('status')
rack_type = attrs.RelatedObjectAttr('rack_type', linkify=True, grouped_by='manufacturer')
@@ -58,13 +60,21 @@ class RackPanel(panels.ObjectAttributesPanel):
class RackWeightPanel(panels.ObjectAttributesPanel):
weight = attrs.NumericAttr('weight', unit_accessor='get_weight_unit_display')
max_weight = attrs.NumericAttr('max_weight', unit_accessor='get_weight_unit_display', label=_('Maximum weight'))
total_weight = attrs.NumericAttr('total_weight', unit_accessor='get_weight_unit_display')
total_weight = attrs.TemplatedAttr('total_weight', template_name='dcim/rack/attrs/total_weight.html')
class RackRolePanel(panels.OrganizationalObjectPanel):
color = attrs.ColorAttr('color')
class RackReservationPanel(panels.ObjectAttributesPanel):
units = attrs.TextAttr('unit_list')
status = attrs.ChoiceAttr('status')
tenant = attrs.RelatedObjectAttr('tenant', linkify=True, grouped_by='group')
user = attrs.RelatedObjectAttr('user')
description = attrs.TextAttr('description')
class RackTypePanel(panels.ObjectAttributesPanel):
manufacturer = attrs.RelatedObjectAttr('manufacturer', linkify=True)
model = attrs.TextAttr('model')

View File

@@ -866,6 +866,7 @@ class RackTypeListView(generic.ObjectListView):
@register_model_view(RackType)
class RackTypeView(GetRelatedModelsMixin, generic.ObjectView):
template_name = 'generic/object.html'
queryset = RackType.objects.all()
layout = layout.SimpleLayout(
left_panels=[
@@ -1147,14 +1148,14 @@ class RackReservationView(generic.ObjectView):
queryset = RackReservation.objects.all()
layout = layout.SimpleLayout(
left_panels=[
panels.RackPanel(accessor='object.rack', only=['region', 'site', 'location']),
panels.RackPanel(accessor='object.rack', only=['region', 'site', 'location', 'name']),
panels.RackReservationPanel(title=_('Reservation')),
CustomFieldsPanel(),
TagsPanel(),
CommentsPanel(),
ImageAttachmentsPanel(),
],
right_panels=[
TemplatePanel('dcim/panels/rack_elevations.html'),
TemplatePanel(template_name='dcim/panels/rack_reservation_elevations.html'),
RelatedObjectsPanel(),
],
)
@@ -1570,6 +1571,7 @@ class ModuleTypeProfileListView(generic.ObjectListView):
@register_model_view(ModuleTypeProfile)
class ModuleTypeProfileView(GetRelatedModelsMixin, generic.ObjectView):
template_name = 'generic/object.html'
queryset = ModuleTypeProfile.objects.all()
layout = layout.SimpleLayout(
left_panels=[