mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-26 09:16:10 -06:00
updated templates
This commit is contained in:
parent
f419a8b922
commit
1ba6f50db2
@ -1738,13 +1738,30 @@ class DeviceRoleView(generic.ObjectView):
|
||||
}
|
||||
|
||||
|
||||
@register_model_view(DeviceRole, 'devices', path='devices')
|
||||
class DeviceRoleDevicesView(generic.ObjectChildrenView):
|
||||
queryset = DeviceRole.objects.all()
|
||||
child_model = Device
|
||||
table = tables.DeviceTable
|
||||
filterset = filtersets.DeviceFilterSet
|
||||
template_name = 'dcim/devicerole/devices.html'
|
||||
tab = ViewTab(
|
||||
label=_('Devices'),
|
||||
badge=lambda obj: obj.devices.count(),
|
||||
permission='dcim.view_device',
|
||||
weight=400
|
||||
)
|
||||
|
||||
def get_children(self, request, parent):
|
||||
return Device.objects.restrict(request.user, 'view').filter(device_role=parent)
|
||||
|
||||
@register_model_view(DeviceRole, 'virtual_machines', path='virtual-machines')
|
||||
class DeviceRoleVirtualMachinesView(generic.ObjectChildrenView):
|
||||
queryset = DeviceRole.objects.all()
|
||||
child_model = VirtualMachine
|
||||
table = VirtualMachineTable
|
||||
filterset = VirtualMachineFilterSet
|
||||
template_name = 'virtualization/cluster/virtual_machines.html'
|
||||
template_name = 'dcim/devicerole/virtual_machines.html'
|
||||
tab = ViewTab(
|
||||
label=_('Virtual machines'),
|
||||
badge=lambda obj: obj.virtual_machines.count(),
|
||||
|
@ -71,13 +71,6 @@
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col col-md-12">
|
||||
<div class="card">
|
||||
<h5 class="card-header">Devices</h5>
|
||||
<div class="card-body table-responsive">
|
||||
{% render_table devices_table 'inc/table.html' %}
|
||||
{% include 'inc/paginator.html' with paginator=devices_table.paginator page=devices_table.page %}
|
||||
</div>
|
||||
</div>
|
||||
{% plugin_full_width_page object %}
|
||||
</div>
|
||||
</div>
|
||||
|
20
netbox/templates/dcim/devicerole/devices.html
Normal file
20
netbox/templates/dcim/devicerole/devices.html
Normal file
@ -0,0 +1,20 @@
|
||||
{% extends 'dcim/devicerole.html' %}
|
||||
{% load helpers %}
|
||||
{% load render_table from django_tables2 %}
|
||||
|
||||
{% block content %}
|
||||
{% include 'inc/table_controls_htmx.html' with table_modal='DeviceTable_config' %}
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<div class="card">
|
||||
<div class="card-body" id="object_list">
|
||||
{% include 'htmx/table.html' %}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock content %}
|
||||
|
||||
{% block modals %}
|
||||
{{ block.super }}
|
||||
{% table_config_form table %}
|
||||
{% endblock modals %}
|
20
netbox/templates/dcim/devicerole/virtual_machines.html
Normal file
20
netbox/templates/dcim/devicerole/virtual_machines.html
Normal file
@ -0,0 +1,20 @@
|
||||
{% extends 'dcim/devicerole.html' %}
|
||||
{% load helpers %}
|
||||
{% load render_table from django_tables2 %}
|
||||
|
||||
{% block content %}
|
||||
{% include 'inc/table_controls_htmx.html' with table_modal='VirtualMachineTable_config' %}
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<div class="card">
|
||||
<div class="card-body" id="object_list">
|
||||
{% include 'htmx/table.html' %}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock content %}
|
||||
|
||||
{% block modals %}
|
||||
{{ block.super }}
|
||||
{% table_config_form table %}
|
||||
{% endblock modals %}
|
Loading…
Reference in New Issue
Block a user