Misc cleanup

This commit is contained in:
jeremystretch 2021-12-17 16:27:03 -05:00
parent 7777922bef
commit e0d7511eaa
2 changed files with 12 additions and 10 deletions

View File

@ -2200,7 +2200,7 @@ class RearPortBulkDeleteView(generic.BulkDeleteView):
#
class ModuleBayListView(generic.ObjectListView):
queryset = ModuleBay.objects.all()
queryset = ModuleBay.objects.select_related('installed_module__module_type')
filterset = filtersets.ModuleBayFilterSet
filterset_form = forms.ModuleBayFilterForm
table = tables.ModuleBayTable

View File

@ -12,7 +12,7 @@
<tr>
<th scope="row">Device</th>
<td>
<a href="{{ object.device.get_absolute_url }}">{{ object.device }}</a>
<a href="{% url 'dcim:device_modulebays' pk=object.device.pk %}">{{ object.device }}</a>
</td>
</tr>
<tr>
@ -30,26 +30,28 @@
</table>
</div>
</div>
{% include 'inc/panels/custom_fields.html' %}
{% include 'inc/panels/tags.html' %}
{% plugin_left_page object %}
{% include 'inc/panels/tags.html' %}
{% plugin_left_page object %}
</div>
<div class="col col-md-6">
{% include 'inc/panels/custom_fields.html' %}
<div class="card">
<h5 class="card-header">Installed Module</h5>
<div class="card-body">
{% if object.module %}
{% with module=object.module %}
{% if object.installed_module %}
{% with module=object.installed_module %}
<table class="table table-hover attr-table">
<tr>
<th scope="row">Module</th>
<th scope="row">Manufacturer</th>
<td>
<a href="{{ module.get_absolute_url }}">{{ module }}</a>
<a href="{{ module.module_type.manufacturer.get_absolute_url }}">{{ module.module_type.manufacturer }}</a>
</td>
</tr>
<tr>
<th scope="row">Module Type</th>
<td>{{ module.module_type }}</td>
<td>
<a href="{{ module.get_absolute_url }}">{{ module.module_type }}</a>
</td>
</tr>
</table>
{% endwith %}