From 4ef39db4d4fe5b5cfffb5eea3fde191801fa48a2 Mon Sep 17 00:00:00 2001 From: Brian Tiemann Date: Tue, 10 Mar 2026 16:23:42 -0400 Subject: [PATCH] Review tweaks --- netbox/dcim/api/serializers_/cables.py | 3 ++- netbox/dcim/forms/bulk_edit.py | 2 +- netbox/dcim/forms/filtersets.py | 1 + netbox/dcim/graphql/filters.py | 2 +- netbox/dcim/migrations/0228_cable_bundle.py | 1 + netbox/dcim/views.py | 4 ++-- netbox/templates/dcim/cablebundle.html | 6 ------ 7 files changed, 8 insertions(+), 11 deletions(-) diff --git a/netbox/dcim/api/serializers_/cables.py b/netbox/dcim/api/serializers_/cables.py index 9cebddd61..eb10a2b61 100644 --- a/netbox/dcim/api/serializers_/cables.py +++ b/netbox/dcim/api/serializers_/cables.py @@ -26,12 +26,13 @@ __all__ = ( class CableBundleSerializer(PrimaryModelSerializer): + cable_count = serializers.IntegerField(read_only=True, default=None) class Meta: model = CableBundle fields = [ 'id', 'url', 'display_url', 'display', 'name', 'description', 'comments', 'tags', - 'custom_fields', 'created', 'last_updated', + 'custom_fields', 'created', 'last_updated', 'cable_count', ] brief_fields = ('id', 'url', 'display', 'name', 'description') diff --git a/netbox/dcim/forms/bulk_edit.py b/netbox/dcim/forms/bulk_edit.py index 1ed87b5d6..ec703e90b 100644 --- a/netbox/dcim/forms/bulk_edit.py +++ b/netbox/dcim/forms/bulk_edit.py @@ -856,7 +856,7 @@ class CableBulkEditForm(PrimaryModelBulkEditForm): model = Cable fieldsets = ( - FieldSet('type', 'status', 'profile', 'tenant', 'label', 'description'), + FieldSet('type', 'status', 'profile', 'tenant', 'bundle', 'label', 'description'), FieldSet('color', 'length', 'length_unit', name=_('Attributes')), ) nullable_fields = ( diff --git a/netbox/dcim/forms/filtersets.py b/netbox/dcim/forms/filtersets.py index 404cf9c27..b1a54842f 100644 --- a/netbox/dcim/forms/filtersets.py +++ b/netbox/dcim/forms/filtersets.py @@ -1179,6 +1179,7 @@ class CableBundleFilterForm(PrimaryModelFilterSetForm): FieldSet('q', 'filter_id', 'tag'), FieldSet('name', name=_('Attributes')), ) + tag = TagFilterField(model) class CableFilterForm(TenancyFilterForm, PrimaryModelFilterSetForm): diff --git a/netbox/dcim/graphql/filters.py b/netbox/dcim/graphql/filters.py index a4ac11c0f..85a7dfdf5 100644 --- a/netbox/dcim/graphql/filters.py +++ b/netbox/dcim/graphql/filters.py @@ -108,7 +108,7 @@ __all__ = ( ) -@strawberry_django.filter(models.CableBundle, lookups=True) +@strawberry_django.filter_type(models.CableBundle, lookups=True) class CableBundleFilter(PrimaryModelFilter): name: StrFilterLookup[str] | None = strawberry_django.filter_field() diff --git a/netbox/dcim/migrations/0228_cable_bundle.py b/netbox/dcim/migrations/0228_cable_bundle.py index ea7e772bc..66c3976fc 100644 --- a/netbox/dcim/migrations/0228_cable_bundle.py +++ b/netbox/dcim/migrations/0228_cable_bundle.py @@ -48,6 +48,7 @@ class Migration(migrations.Migration): on_delete=django.db.models.deletion.SET_NULL, related_name='cables', to='dcim.cablebundle', + verbose_name='bundle', ), ), ] diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index 5798a0105..d9afc14dd 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -4036,8 +4036,8 @@ class CableBundleView(generic.ObjectView): queryset = CableBundle.objects.all() def get_extra_context(self, request, instance): - # Not prefetching terminations as they are not included in the default inline table layout. See CableListView - # for prefetch pattern if terminations are necessary here. + # Not prefetching related cable terminations as they are not included in the default inline CableTable layout. + # See CableListView for prefetch pattern if terminations are necessary here. cables_table = tables.CableTable( instance.cables.all(), orderable=False, diff --git a/netbox/templates/dcim/cablebundle.html b/netbox/templates/dcim/cablebundle.html index c71715026..cb1237f2a 100644 --- a/netbox/templates/dcim/cablebundle.html +++ b/netbox/templates/dcim/cablebundle.html @@ -21,12 +21,6 @@ {% trans "Description" %} {{ object.description|placeholder }} - - {% trans "Cables" %} - - {{ object.cables.count }} - - {% include 'inc/panels/custom_fields.html' %}