diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index 497935b1533..2a2fe39e316 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -58,7 +58,11 @@ def get_children(self, request, parent): return self.child_model.objects.restrict(request.user, 'view').filter(device=parent) -class DeviceTypeComponentsView(DeviceComponentsView): +class DeviceTypeComponentsView(generic.ObjectChildrenView): + actions = { + **DEFAULT_ACTION_PERMISSIONS, + 'bulk_rename': {'change'}, + } queryset = DeviceType.objects.all() template_name = 'dcim/devicetype/component_templates.html' viewname = None # Used for return_url resolution diff --git a/netbox/templates/dcim/devicetype/component_templates.html b/netbox/templates/dcim/devicetype/component_templates.html index 9a521076297..5d60f6de53f 100644 --- a/netbox/templates/dcim/devicetype/component_templates.html +++ b/netbox/templates/dcim/devicetype/component_templates.html @@ -1,45 +1,37 @@ -{% extends 'dcim/devicetype/base.html' %} -{% load render_table from django_tables2 %} +{% extends 'generic/object_children.html' %} {% load helpers %} {% load i18n %} +{% load perms %} -{% block content %} - {% if perms.dcim.change_devicetype %} -
- {% csrf_token %} -
-
{{ title }}
-
- {% include 'htmx/table.html' %} -
- +{% block bulk_edit_controls %} + {% with bulk_edit_view=child_model|validated_viewname:"bulk_edit" %} + {% if 'bulk_edit' in actions and bulk_edit_view %} + + {% endif %} + {% endwith %} + {% with bulk_rename_view=child_model|validated_viewname:"bulk_rename" %} + {% if 'bulk_rename' in actions and bulk_rename_view %} + + {% endif %} + {% endwith %} +{% endblock bulk_edit_controls %} + +{% block bulk_extra_controls %} + {{ block.super }} + {% if request.user|can_add:child_model %} + - - {% else %} -
-
{{ title }}
-
- {% include 'htmx/table.html' %} -
-
- {% endif %} -{% endblock content %} + {% endif %} +{% endblock bulk_extra_controls %}