Skip to content

Commit 7b0e8c1

Browse files
committed
Remove obsolete template HTML
1 parent 917280d commit 7b0e8c1

File tree

17 files changed

+36
-1285
lines changed

17 files changed

+36
-1285
lines changed

netbox/dcim/ui/panels.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
class SitePanel(panels.ObjectAttributesPanel):
77
region = attrs.NestedObjectAttr('region', linkify=True)
88
group = attrs.NestedObjectAttr('group', linkify=True)
9+
name = attrs.TextAttr('name')
910
status = attrs.ChoiceAttr('status')
1011
tenant = attrs.RelatedObjectAttr('tenant', linkify=True, grouped_by='group')
1112
facility = attrs.TextAttr('facility')
@@ -42,7 +43,8 @@ class RackPanel(panels.ObjectAttributesPanel):
4243
region = attrs.NestedObjectAttr('site.region', linkify=True)
4344
site = attrs.RelatedObjectAttr('site', linkify=True, grouped_by='group')
4445
location = attrs.NestedObjectAttr('location', linkify=True)
45-
facility = attrs.TextAttr('facility')
46+
name = attrs.TextAttr('name')
47+
facility = attrs.TextAttr('facility', label=_('Facility ID'))
4648
tenant = attrs.RelatedObjectAttr('tenant', linkify=True, grouped_by='group')
4749
status = attrs.ChoiceAttr('status')
4850
rack_type = attrs.RelatedObjectAttr('rack_type', linkify=True, grouped_by='manufacturer')
@@ -58,13 +60,21 @@ class RackPanel(panels.ObjectAttributesPanel):
5860
class RackWeightPanel(panels.ObjectAttributesPanel):
5961
weight = attrs.NumericAttr('weight', unit_accessor='get_weight_unit_display')
6062
max_weight = attrs.NumericAttr('max_weight', unit_accessor='get_weight_unit_display', label=_('Maximum weight'))
61-
total_weight = attrs.NumericAttr('total_weight', unit_accessor='get_weight_unit_display')
63+
total_weight = attrs.TemplatedAttr('total_weight', template_name='dcim/rack/attrs/total_weight.html')
6264

6365

6466
class RackRolePanel(panels.OrganizationalObjectPanel):
6567
color = attrs.ColorAttr('color')
6668

6769

70+
class RackReservationPanel(panels.ObjectAttributesPanel):
71+
units = attrs.TextAttr('unit_list')
72+
status = attrs.ChoiceAttr('status')
73+
tenant = attrs.RelatedObjectAttr('tenant', linkify=True, grouped_by='group')
74+
user = attrs.RelatedObjectAttr('user')
75+
description = attrs.TextAttr('description')
76+
77+
6878
class RackTypePanel(panels.ObjectAttributesPanel):
6979
manufacturer = attrs.RelatedObjectAttr('manufacturer', linkify=True)
7080
model = attrs.TextAttr('model')

netbox/dcim/views.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,7 @@ class RackTypeListView(generic.ObjectListView):
866866

867867
@register_model_view(RackType)
868868
class RackTypeView(GetRelatedModelsMixin, generic.ObjectView):
869+
template_name = 'generic/object.html'
869870
queryset = RackType.objects.all()
870871
layout = layout.SimpleLayout(
871872
left_panels=[
@@ -1147,14 +1148,14 @@ class RackReservationView(generic.ObjectView):
11471148
queryset = RackReservation.objects.all()
11481149
layout = layout.SimpleLayout(
11491150
left_panels=[
1150-
panels.RackPanel(accessor='object.rack', only=['region', 'site', 'location']),
1151+
panels.RackPanel(accessor='object.rack', only=['region', 'site', 'location', 'name']),
1152+
panels.RackReservationPanel(title=_('Reservation')),
11511153
CustomFieldsPanel(),
11521154
TagsPanel(),
11531155
CommentsPanel(),
1154-
ImageAttachmentsPanel(),
11551156
],
11561157
right_panels=[
1157-
TemplatePanel('dcim/panels/rack_elevations.html'),
1158+
TemplatePanel(template_name='dcim/panels/rack_reservation_elevations.html'),
11581159
RelatedObjectsPanel(),
11591160
],
11601161
)
@@ -1570,6 +1571,7 @@ class ModuleTypeProfileListView(generic.ObjectListView):
15701571

15711572
@register_model_view(ModuleTypeProfile)
15721573
class ModuleTypeProfileView(GetRelatedModelsMixin, generic.ObjectView):
1574+
template_name = 'generic/object.html'
15731575
queryset = ModuleTypeProfile.objects.all()
15741576
layout = layout.SimpleLayout(
15751577
left_panels=[

netbox/netbox/ui/panels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ class NestedGroupObjectPanel(ObjectAttributesPanel, metaclass=ObjectAttributesPa
198198
"""
199199
An ObjectPanel with attributes common to NestedGroupObjects. Includes the `parent` attribute.
200200
"""
201-
name = attrs.TextAttr('name', label=_('Name'))
202201
parent = attrs.NestedObjectAttr('parent', label=_('Parent'), linkify=True)
202+
name = attrs.TextAttr('name', label=_('Name'))
203203
description = attrs.TextAttr('description', label=_('Description'))
204204

205205

netbox/templates/dcim/device.html

Lines changed: 0 additions & 374 deletions
Large diffs are not rendered by default.
Lines changed: 0 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1 @@
11
{% extends 'dcim/devicetype/base.html' %}
2-
{% load buttons %}
3-
{% load helpers %}
4-
{% load plugins %}
5-
{% load i18n %}
6-
7-
{% block content %}
8-
<div class="row">
9-
<div class="col col-12 col-md-6">
10-
<div class="card">
11-
<h2 class="card-header">{% trans "Chassis" %}</h2>
12-
<table class="table table-hover attr-table">
13-
<tr>
14-
<th scope="row">{% trans "Manufacturer" %}</th>
15-
<td>{{ object.manufacturer|linkify }}</td>
16-
</tr>
17-
<tr>
18-
<th scope="row">{% trans "Model Name" %}</th>
19-
<td>
20-
{{ object.model }}<br/>
21-
<small class="text-muted">{{ object.slug }}</small>
22-
</td>
23-
</tr>
24-
<tr>
25-
<th scope="row">{% trans "Part Number" %}</th>
26-
<td>{{ object.part_number|placeholder }}</td>
27-
</tr>
28-
<tr>
29-
<th scope="row">{% trans "Default Platform" %}</th>
30-
<td>{{ object.default_platform|linkify }}</td>
31-
</tr>
32-
<tr>
33-
<th scope="row">{% trans "Description" %}</th>
34-
<td>{{ object.description|placeholder }}</td>
35-
</tr>
36-
<tr>
37-
<th scope="row">{% trans "Height (U)" %}</th>
38-
<td>{{ object.u_height|floatformat }}</td>
39-
</tr>
40-
<tr>
41-
<th scope="row">{% trans "Exclude From Utilization" %}</th>
42-
<td>{% checkmark object.exclude_from_utilization %}</td>
43-
</tr>
44-
<tr>
45-
<th scope="row">{% trans "Full Depth" %}</th>
46-
<td>{% checkmark object.is_full_depth %}</td>
47-
</tr>
48-
<tr>
49-
<th scope="row">{% trans "Weight" %}</th>
50-
<td>
51-
{% if object.weight %}
52-
{{ object.weight|floatformat }} {{ object.get_weight_unit_display }}
53-
{% else %}
54-
{{ ''|placeholder }}
55-
{% endif %}
56-
</td>
57-
</tr>
58-
<tr>
59-
<th scope="row">{% trans "Parent/Child" %}</th>
60-
<td>
61-
{{ object.get_subdevice_role_display|placeholder }}
62-
</td>
63-
</tr>
64-
<tr>
65-
<th scope="row">{% trans "Airflow" %}</th>
66-
<td>
67-
{{ object.get_airflow_display|placeholder }}
68-
</td>
69-
</tr>
70-
<tr>
71-
<th scope="row">{% trans "Front Image" %}</th>
72-
<td>
73-
{% if object.front_image %}
74-
<a href="{{ object.front_image.url }}">
75-
<img src="{{ object.front_image.url }}" alt="{{ object.front_image.name }}" class="img-fluid" />
76-
</a>
77-
{% else %}
78-
{{ ''|placeholder }}
79-
{% endif %}
80-
</td>
81-
</tr>
82-
<tr>
83-
<th scope="row">{% trans "Rear Image" %}</th>
84-
<td>
85-
{% if object.rear_image %}
86-
<a href="{{ object.rear_image.url }}">
87-
<img src="{{ object.rear_image.url }}" alt="{{ object.rear_image.name }}" class="img-fluid" />
88-
</a>
89-
{% else %}
90-
{{ ''|placeholder }}
91-
{% endif %}
92-
</td>
93-
</tr>
94-
</table>
95-
</div>
96-
{% include 'inc/panels/tags.html' %}
97-
{% plugin_left_page object %}
98-
</div>
99-
<div class="col col-12 col-md-6">
100-
{% include 'inc/panels/related_objects.html' %}
101-
{% include 'inc/panels/custom_fields.html' %}
102-
{% include 'inc/panels/comments.html' %}
103-
{% include 'inc/panels/image_attachments.html' %}
104-
{% plugin_right_page object %}
105-
</div>
106-
</div>
107-
<div class="row">
108-
<div class="col col-md-12">
109-
{% plugin_full_width_page object %}
110-
</div>
111-
</div>
112-
{% endblock %}
Lines changed: 0 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,8 @@
11
{% extends 'generic/object.html' %}
2-
{% load helpers %}
3-
{% load plugins %}
4-
{% load render_table from django_tables2 %}
5-
{% load i18n %}
62

73
{% block breadcrumbs %}
84
{{ block.super }}
95
{% for location in object.get_ancestors %}
106
<li class="breadcrumb-item">{{ location|linkify }}</li>
117
{% endfor %}
128
{% endblock %}
13-
14-
{% block extra_controls %}
15-
{% if perms.dcim.add_location %}
16-
<a href="{% url 'dcim:location_add' %}?site={{ object.site.pk }}&parent={{ object.pk }}" class="btn btn-primary">
17-
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> {% trans "Add Child Location" %}
18-
</a>
19-
{% endif %}
20-
{% endblock extra_controls %}
21-
22-
{% block content %}
23-
<div class="row mb-3">
24-
<div class="col col-12 col-md-6">
25-
<div class="card">
26-
<h2 class="card-header">{% trans "Location" %}</h2>
27-
<table class="table table-hover attr-table">
28-
<tr>
29-
<th scope="row">{% trans "Name" %}</th>
30-
<td>{{ object.name }}</td>
31-
</tr>
32-
<tr>
33-
<th scope="row">{% trans "Description" %}</th>
34-
<td>{{ object.description|placeholder }}</td>
35-
</tr>
36-
<tr>
37-
<th scope="row">{% trans "Site" %}</th>
38-
<td>{{ object.site|linkify }}</td>
39-
</tr>
40-
<tr>
41-
<th scope="row">{% trans "Parent" %}</th>
42-
<td>{{ object.parent|linkify|placeholder }}</td>
43-
</tr>
44-
<tr>
45-
<th scope="row">{% trans "Status" %}</th>
46-
<td>{% badge object.get_status_display bg_color=object.get_status_color %}</td>
47-
</tr>
48-
<tr>
49-
<th scope="row">{% trans "Tenant" %}</th>
50-
<td>
51-
{% if object.tenant.group %}
52-
{{ object.tenant.group|linkify }} /
53-
{% endif %}
54-
{{ object.tenant|linkify|placeholder }}
55-
</td>
56-
</tr>
57-
<tr>
58-
<th scope="row">{% trans "Facility" %}</th>
59-
<td>{{ object.facility|placeholder }}</td>
60-
</tr>
61-
</table>
62-
</div>
63-
{% include 'inc/panels/tags.html' %}
64-
{% include 'inc/panels/custom_fields.html' %}
65-
{% include 'inc/panels/comments.html' %}
66-
{% plugin_left_page object %}
67-
</div>
68-
<div class="col col-12 col-md-6">
69-
{% include 'inc/panels/related_objects.html' %}
70-
{% include 'inc/panels/image_attachments.html' %}
71-
{% plugin_right_page object %}
72-
</div>
73-
</div>
74-
<div class="row mb-3">
75-
<div class="col col-md-12">
76-
<div class="card">
77-
<h2 class="card-header">
78-
{% trans "Child Locations" %}
79-
{% if perms.dcim.add_location %}
80-
<div class="card-actions">
81-
<a href="{% url 'dcim:location_add' %}?site={{ object.site.pk }}&parent={{ object.pk }}&return_url={{ object.get_absolute_url }}" class="btn btn-ghost-primary btn-sm">
82-
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> {% trans "Add a Location" %}
83-
</a>
84-
</div>
85-
{% endif %}
86-
</h2>
87-
{% htmx_table 'dcim:location_list' parent_id=object.pk %}
88-
</div>
89-
<div class="card">
90-
<h2 class="card-header">
91-
{% trans "Non-Racked Devices" %}
92-
{% if perms.dcim.add_device %}
93-
<div class="card-actions">
94-
<a href="{% url 'dcim:device_add' %}?site={{ object.site.pk }}&location={{ object.pk }}&return_url={{ object.get_absolute_url }}" class="btn btn-ghost-primary btn-sm">
95-
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> {% trans "Add a Device" %}
96-
</a>
97-
</div>
98-
{% endif %}
99-
</h2>
100-
{% htmx_table 'dcim:device_list' location_id=object.pk rack_id='null' parent_bay_id='null' %}
101-
</div>
102-
{% plugin_full_width_page object %}
103-
</div>
104-
</div>
105-
{% endblock %}
Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{% extends 'generic/object.html' %}
2-
{% load helpers %}
3-
{% load plugins %}
4-
{% load render_table from django_tables2 %}
52
{% load i18n %}
63

74
{% block extra_controls %}
@@ -25,35 +22,3 @@
2522
</div>
2623
{% endif %}
2724
{% endblock extra_controls %}
28-
29-
{% block content %}
30-
<div class="row mb-3">
31-
<div class="col col-12 col-md-6">
32-
<div class="card">
33-
<h2 class="card-header">{% trans "Manufacturer" %}</h2>
34-
<table class="table table-hover attr-table">
35-
<tr>
36-
<th scope="row">{% trans "Name" %}</th>
37-
<td>{{ object.name }}</td>
38-
</tr>
39-
<tr>
40-
<th scope="row">{% trans "Description" %}</th>
41-
<td>{{ object.description|placeholder }}</td>
42-
</tr>
43-
</table>
44-
</div>
45-
{% include 'inc/panels/tags.html' %}
46-
{% plugin_left_page object %}
47-
</div>
48-
<div class="col col-12 col-md-6">
49-
{% include 'inc/panels/related_objects.html' %}
50-
{% include 'inc/panels/custom_fields.html' %}
51-
{% plugin_right_page object %}
52-
</div>
53-
</div>
54-
<div class="row mb-3">
55-
<div class="col col-md-12">
56-
{% plugin_full_width_page object %}
57-
</div>
58-
</div>
59-
{% endblock %}

0 commit comments

Comments
 (0)