diff --git a/netbox/circuits/api/serializers_/circuits.py b/netbox/circuits/api/serializers_/circuits.py index 79e50da28..6ac4f39a3 100644 --- a/netbox/circuits/api/serializers_/circuits.py +++ b/netbox/circuits/api/serializers_/circuits.py @@ -38,7 +38,7 @@ class CircuitTypeSerializer(OrganizationalModelSerializer): class Meta: model = CircuitType fields = [ - 'id', 'url', 'display_url', 'display', 'name', 'slug', 'color', 'description', 'owner', 'tags', + 'id', 'url', 'display_url', 'display', 'name', 'slug', 'color', 'description', 'owner', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', 'circuit_count', ] brief_fields = ('id', 'url', 'display', 'name', 'slug', 'description', 'circuit_count') @@ -71,7 +71,7 @@ class CircuitGroupSerializer(OrganizationalModelSerializer): class Meta: model = CircuitGroup fields = [ - 'id', 'url', 'display_url', 'display', 'name', 'slug', 'description', 'tenant', 'owner', 'tags', + 'id', 'url', 'display_url', 'display', 'name', 'slug', 'description', 'tenant', 'owner', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', 'circuit_count' ] brief_fields = ('id', 'url', 'display', 'name') @@ -161,7 +161,7 @@ class VirtualCircuitTypeSerializer(OrganizationalModelSerializer): class Meta: model = VirtualCircuitType fields = [ - 'id', 'url', 'display_url', 'display', 'name', 'slug', 'color', 'description', 'owner', 'tags', + 'id', 'url', 'display_url', 'display', 'name', 'slug', 'color', 'description', 'owner', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', 'virtual_circuit_count', ] brief_fields = ('id', 'url', 'display', 'name', 'slug', 'description', 'virtual_circuit_count') diff --git a/netbox/circuits/forms/bulk_edit.py b/netbox/circuits/forms/bulk_edit.py index 58b2642ea..d03577ab9 100644 --- a/netbox/circuits/forms/bulk_edit.py +++ b/netbox/circuits/forms/bulk_edit.py @@ -99,7 +99,7 @@ class CircuitTypeBulkEditForm(OrganizationalModelBulkEditForm): fieldsets = ( FieldSet('color', 'description'), ) - nullable_fields = ('color', 'description') + nullable_fields = ('color', 'description', 'comments') class CircuitBulkEditForm(PrimaryModelBulkEditForm): @@ -241,7 +241,7 @@ class CircuitGroupBulkEditForm(OrganizationalModelBulkEditForm): model = CircuitGroup nullable_fields = ( - 'description', 'tenant', + 'description', 'tenant', 'comments', ) @@ -274,7 +274,7 @@ class VirtualCircuitTypeBulkEditForm(OrganizationalModelBulkEditForm): fieldsets = ( FieldSet('color', 'description'), ) - nullable_fields = ('color', 'description') + nullable_fields = ('color', 'description', 'comments') class VirtualCircuitBulkEditForm(PrimaryModelBulkEditForm): diff --git a/netbox/circuits/forms/bulk_import.py b/netbox/circuits/forms/bulk_import.py index 22b7a159c..dbcd1554b 100644 --- a/netbox/circuits/forms/bulk_import.py +++ b/netbox/circuits/forms/bulk_import.py @@ -73,7 +73,7 @@ class CircuitTypeImportForm(OrganizationalModelImportForm): class Meta: model = CircuitType - fields = ('name', 'slug', 'color', 'description', 'owner', 'tags') + fields = ('name', 'slug', 'color', 'description', 'owner', 'comments', 'tags') class CircuitImportForm(PrimaryModelImportForm): @@ -176,7 +176,7 @@ class CircuitGroupImportForm(OrganizationalModelImportForm): class Meta: model = CircuitGroup - fields = ('name', 'slug', 'description', 'tenant', 'owner', 'tags') + fields = ('name', 'slug', 'description', 'tenant', 'owner', 'comments', 'tags') class CircuitGroupAssignmentImportForm(NetBoxModelImportForm): @@ -199,7 +199,7 @@ class VirtualCircuitTypeImportForm(OrganizationalModelImportForm): class Meta: model = VirtualCircuitType - fields = ('name', 'slug', 'color', 'description', 'owner', 'tags') + fields = ('name', 'slug', 'color', 'description', 'owner', 'comments', 'tags') class VirtualCircuitImportForm(PrimaryModelImportForm): diff --git a/netbox/circuits/forms/model_forms.py b/netbox/circuits/forms/model_forms.py index 4e8f54773..906fe8952 100644 --- a/netbox/circuits/forms/model_forms.py +++ b/netbox/circuits/forms/model_forms.py @@ -97,7 +97,7 @@ class CircuitTypeForm(OrganizationalModelForm): class Meta: model = CircuitType fields = [ - 'name', 'slug', 'color', 'description', 'tags', + 'name', 'slug', 'color', 'description', 'comments', 'tags', ] @@ -236,7 +236,7 @@ class CircuitGroupForm(TenancyForm, OrganizationalModelForm): class Meta: model = CircuitGroup fields = [ - 'name', 'slug', 'description', 'tenant_group', 'tenant', 'owner', 'tags', + 'name', 'slug', 'description', 'tenant_group', 'tenant', 'owner', 'comments', 'tags', ] @@ -307,7 +307,7 @@ class VirtualCircuitTypeForm(OrganizationalModelForm): class Meta: model = VirtualCircuitType fields = [ - 'name', 'slug', 'color', 'description', 'owner', 'tags', + 'name', 'slug', 'color', 'description', 'owner', 'comments', 'tags', ] diff --git a/netbox/circuits/migrations/0055_add_comments_to_organizationalmodel.py b/netbox/circuits/migrations/0055_add_comments_to_organizationalmodel.py new file mode 100644 index 000000000..5e67aabc0 --- /dev/null +++ b/netbox/circuits/migrations/0055_add_comments_to_organizationalmodel.py @@ -0,0 +1,28 @@ +# Generated by Django 5.2.8 on 2025-12-08 17:38 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('circuits', '0054_cable_position'), + ] + + operations = [ + migrations.AddField( + model_name='circuitgroup', + name='comments', + field=models.TextField(blank=True), + ), + migrations.AddField( + model_name='circuittype', + name='comments', + field=models.TextField(blank=True), + ), + migrations.AddField( + model_name='virtualcircuittype', + name='comments', + field=models.TextField(blank=True), + ), + ] diff --git a/netbox/circuits/search.py b/netbox/circuits/search.py index f7654e328..6c25d3a9c 100644 --- a/netbox/circuits/search.py +++ b/netbox/circuits/search.py @@ -20,6 +20,7 @@ class CircuitGroupIndex(SearchIndex): ('name', 100), ('slug', 110), ('description', 500), + ('comments', 5000), ) display_attrs = ('description',) @@ -44,6 +45,7 @@ class CircuitTypeIndex(SearchIndex): ('name', 100), ('slug', 110), ('description', 500), + ('comments', 5000), ) display_attrs = ('description',) @@ -109,5 +111,6 @@ class VirtualCircuitTypeIndex(SearchIndex): ('name', 100), ('slug', 110), ('description', 500), + ('comments', 5000), ) display_attrs = ('description',) diff --git a/netbox/circuits/tables/circuits.py b/netbox/circuits/tables/circuits.py index 1c0e79d19..ae4e2c8bd 100644 --- a/netbox/circuits/tables/circuits.py +++ b/netbox/circuits/tables/circuits.py @@ -40,8 +40,8 @@ class CircuitTypeTable(OrganizationalModelTable): class Meta(OrganizationalModelTable.Meta): model = CircuitType fields = ( - 'pk', 'id', 'name', 'circuit_count', 'color', 'description', 'slug', 'tags', 'created', 'last_updated', - 'actions', + 'pk', 'id', 'name', 'circuit_count', 'color', 'description', 'slug', 'comments', 'tags', 'created', + 'last_updated', 'actions', ) default_columns = ('pk', 'name', 'circuit_count', 'color', 'description') @@ -175,7 +175,7 @@ class CircuitGroupTable(OrganizationalModelTable): class Meta(OrganizationalModelTable.Meta): model = CircuitGroup fields = ( - 'pk', 'name', 'description', 'circuit_group_assignment_count', 'tags', + 'pk', 'name', 'description', 'circuit_group_assignment_count', 'comments', 'tags', 'created', 'last_updated', 'actions', ) default_columns = ('pk', 'name', 'description', 'circuit_group_assignment_count') diff --git a/netbox/dcim/api/serializers_/manufacturers.py b/netbox/dcim/api/serializers_/manufacturers.py index bd6581389..401a4bb29 100644 --- a/netbox/dcim/api/serializers_/manufacturers.py +++ b/netbox/dcim/api/serializers_/manufacturers.py @@ -17,7 +17,7 @@ class ManufacturerSerializer(OrganizationalModelSerializer): class Meta: model = Manufacturer fields = [ - 'id', 'url', 'display_url', 'display', 'name', 'slug', 'description', 'owner', 'tags', 'custom_fields', - 'created', 'last_updated', 'devicetype_count', 'inventoryitem_count', 'platform_count', + 'id', 'url', 'display_url', 'display', 'name', 'slug', 'description', 'owner', 'comments', 'tags', + 'custom_fields', 'created', 'last_updated', 'devicetype_count', 'inventoryitem_count', 'platform_count', ] brief_fields = ('id', 'url', 'display', 'name', 'slug', 'description', 'devicetype_count') diff --git a/netbox/dcim/api/serializers_/racks.py b/netbox/dcim/api/serializers_/racks.py index 503f7bee3..e6f15ccfc 100644 --- a/netbox/dcim/api/serializers_/racks.py +++ b/netbox/dcim/api/serializers_/racks.py @@ -30,7 +30,7 @@ class RackRoleSerializer(OrganizationalModelSerializer): class Meta: model = RackRole fields = [ - 'id', 'url', 'display_url', 'display', 'name', 'slug', 'color', 'description', 'owner', 'tags', + 'id', 'url', 'display_url', 'display', 'name', 'slug', 'color', 'description', 'owner', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', 'rack_count', ] brief_fields = ('id', 'url', 'display', 'name', 'slug', 'description', 'rack_count') diff --git a/netbox/dcim/api/serializers_/roles.py b/netbox/dcim/api/serializers_/roles.py index 83622899c..a1c1d2be9 100644 --- a/netbox/dcim/api/serializers_/roles.py +++ b/netbox/dcim/api/serializers_/roles.py @@ -38,7 +38,7 @@ class InventoryItemRoleSerializer(OrganizationalModelSerializer): class Meta: model = InventoryItemRole fields = [ - 'id', 'url', 'display_url', 'display', 'name', 'slug', 'color', 'description', 'owner', 'tags', + 'id', 'url', 'display_url', 'display', 'name', 'slug', 'color', 'description', 'owner', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', 'inventoryitem_count', ] brief_fields = ('id', 'url', 'display', 'name', 'slug', 'description', 'inventoryitem_count') diff --git a/netbox/dcim/forms/bulk_edit.py b/netbox/dcim/forms/bulk_edit.py index 9aa076a6a..00a0667a7 100644 --- a/netbox/dcim/forms/bulk_edit.py +++ b/netbox/dcim/forms/bulk_edit.py @@ -208,7 +208,7 @@ class RackRoleBulkEditForm(OrganizationalModelBulkEditForm): fieldsets = ( FieldSet('color', 'description'), ) - nullable_fields = ('color', 'description') + nullable_fields = ('color', 'description', 'comments') class RackTypeBulkEditForm(PrimaryModelBulkEditForm): @@ -474,7 +474,7 @@ class ManufacturerBulkEditForm(OrganizationalModelBulkEditForm): fieldsets = ( FieldSet('description'), ) - nullable_fields = ('description',) + nullable_fields = ('description', 'comments') class DeviceTypeBulkEditForm(PrimaryModelBulkEditForm): @@ -1719,7 +1719,7 @@ class InventoryItemRoleBulkEditForm(OrganizationalModelBulkEditForm): fieldsets = ( FieldSet('color', 'description'), ) - nullable_fields = ('color', 'description') + nullable_fields = ('color', 'description', 'comments') class VirtualDeviceContextBulkEditForm(PrimaryModelBulkEditForm): diff --git a/netbox/dcim/forms/bulk_import.py b/netbox/dcim/forms/bulk_import.py index ba0b44b0d..019d2584e 100644 --- a/netbox/dcim/forms/bulk_import.py +++ b/netbox/dcim/forms/bulk_import.py @@ -183,7 +183,7 @@ class RackRoleImportForm(OrganizationalModelImportForm): class Meta: model = RackRole - fields = ('name', 'slug', 'color', 'description', 'owner', 'tags') + fields = ('name', 'slug', 'color', 'description', 'owner', 'comments', 'tags') class RackTypeImportForm(PrimaryModelImportForm): @@ -400,7 +400,7 @@ class ManufacturerImportForm(OrganizationalModelImportForm): class Meta: model = Manufacturer - fields = ('name', 'slug', 'description', 'owner', 'tags') + fields = ('name', 'slug', 'description', 'owner', 'comments', 'tags') class DeviceTypeImportForm(PrimaryModelImportForm): @@ -1311,7 +1311,7 @@ class InventoryItemRoleImportForm(OrganizationalModelImportForm): class Meta: model = InventoryItemRole - fields = ('name', 'slug', 'color', 'description') + fields = ('name', 'slug', 'color', 'description', 'owner', 'comments') # diff --git a/netbox/dcim/forms/model_forms.py b/netbox/dcim/forms/model_forms.py index 66e54b887..54290cdb3 100644 --- a/netbox/dcim/forms/model_forms.py +++ b/netbox/dcim/forms/model_forms.py @@ -201,7 +201,7 @@ class RackRoleForm(OrganizationalModelForm): class Meta: model = RackRole fields = [ - 'name', 'slug', 'color', 'description', 'owner', 'tags', + 'name', 'slug', 'color', 'description', 'owner', 'comments', 'tags', ] @@ -344,7 +344,7 @@ class ManufacturerForm(OrganizationalModelForm): class Meta: model = Manufacturer fields = [ - 'name', 'slug', 'description', 'owner', 'tags', + 'name', 'slug', 'description', 'owner', 'comments', 'tags', ] @@ -1815,7 +1815,7 @@ class InventoryItemRoleForm(OrganizationalModelForm): class Meta: model = InventoryItemRole fields = [ - 'name', 'slug', 'color', 'description', 'owner', 'tags', + 'name', 'slug', 'color', 'description', 'owner', 'comments', 'tags', ] diff --git a/netbox/dcim/migrations/0222_add_comments_to_organizationalmodel.py b/netbox/dcim/migrations/0222_add_comments_to_organizationalmodel.py new file mode 100644 index 000000000..ff65ba728 --- /dev/null +++ b/netbox/dcim/migrations/0222_add_comments_to_organizationalmodel.py @@ -0,0 +1,28 @@ +# Generated by Django 5.2.8 on 2025-12-08 17:38 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('dcim', '0221_cable_position'), + ] + + operations = [ + migrations.AddField( + model_name='inventoryitemrole', + name='comments', + field=models.TextField(blank=True), + ), + migrations.AddField( + model_name='manufacturer', + name='comments', + field=models.TextField(blank=True), + ), + migrations.AddField( + model_name='rackrole', + name='comments', + field=models.TextField(blank=True), + ), + ] diff --git a/netbox/dcim/search.py b/netbox/dcim/search.py index 8ef6a1d44..00dcbfad5 100644 --- a/netbox/dcim/search.py +++ b/netbox/dcim/search.py @@ -137,6 +137,18 @@ class InventoryItemIndex(SearchIndex): display_attrs = ('device', 'manufacturer', 'parent', 'part_id', 'serial', 'asset_tag', 'description') +@register_search +class InventoryItemRoleIndex(SearchIndex): + model = models.InventoryItemRole + fields = ( + ('name', 100), + ('slug', 110), + ('description', 500), + ('comments', 5000), + ) + display_attrs = ('description',) + + @register_search class LocationIndex(SearchIndex): model = models.Location @@ -157,6 +169,7 @@ class ManufacturerIndex(SearchIndex): ('name', 100), ('slug', 110), ('description', 500), + ('comments', 5000), ) display_attrs = ('description',) @@ -308,6 +321,7 @@ class RackRoleIndex(SearchIndex): ('name', 100), ('slug', 110), ('description', 500), + ('comments', 5000), ) display_attrs = ('description',) diff --git a/netbox/dcim/tables/devices.py b/netbox/dcim/tables/devices.py index 5f9467297..7173f608c 100644 --- a/netbox/dcim/tables/devices.py +++ b/netbox/dcim/tables/devices.py @@ -1053,7 +1053,7 @@ class InventoryItemRoleTable(OrganizationalModelTable): class Meta(OrganizationalModelTable.Meta): model = models.InventoryItemRole fields = ( - 'pk', 'id', 'name', 'inventoryitem_count', 'color', 'description', 'slug', 'tags', 'actions', + 'pk', 'id', 'name', 'inventoryitem_count', 'color', 'description', 'slug', 'comments', 'tags', 'actions', ) default_columns = ('pk', 'name', 'inventoryitem_count', 'color', 'description') diff --git a/netbox/dcim/tables/devicetypes.py b/netbox/dcim/tables/devicetypes.py index 979689b75..e99e01204 100644 --- a/netbox/dcim/tables/devicetypes.py +++ b/netbox/dcim/tables/devicetypes.py @@ -64,7 +64,8 @@ class ManufacturerTable(ContactsColumnMixin, OrganizationalModelTable): model = models.Manufacturer fields = ( 'pk', 'id', 'name', 'racktype_count', 'devicetype_count', 'moduletype_count', 'inventoryitem_count', - 'platform_count', 'description', 'slug', 'tags', 'contacts', 'actions', 'created', 'last_updated', + 'platform_count', 'description', 'slug', 'comments', 'tags', 'contacts', 'actions', 'created', + 'last_updated', ) default_columns = ( 'pk', 'name', 'racktype_count', 'devicetype_count', 'moduletype_count', 'inventoryitem_count', diff --git a/netbox/dcim/tables/racks.py b/netbox/dcim/tables/racks.py index 06ccebc2a..c61d82434 100644 --- a/netbox/dcim/tables/racks.py +++ b/netbox/dcim/tables/racks.py @@ -35,7 +35,7 @@ class RackRoleTable(OrganizationalModelTable): class Meta(OrganizationalModelTable.Meta): model = RackRole fields = ( - 'pk', 'id', 'name', 'rack_count', 'color', 'description', 'slug', 'tags', 'actions', 'created', + 'pk', 'id', 'name', 'rack_count', 'color', 'description', 'slug', 'comments', 'tags', 'actions', 'created', 'last_updated', ) default_columns = ('pk', 'name', 'rack_count', 'color', 'description') diff --git a/netbox/ipam/api/serializers_/asns.py b/netbox/ipam/api/serializers_/asns.py index b297ff590..6325a3299 100644 --- a/netbox/ipam/api/serializers_/asns.py +++ b/netbox/ipam/api/serializers_/asns.py @@ -21,8 +21,8 @@ class RIRSerializer(OrganizationalModelSerializer): class Meta: model = RIR fields = [ - 'id', 'url', 'display_url', 'display', 'name', 'slug', 'is_private', 'description', 'owner', 'tags', - 'custom_fields', 'created', 'last_updated', 'aggregate_count', + 'id', 'url', 'display_url', 'display', 'name', 'slug', 'is_private', 'description', 'owner', 'comments', + 'tags', 'custom_fields', 'created', 'last_updated', 'aggregate_count', ] brief_fields = ('id', 'url', 'display', 'name', 'slug', 'description', 'aggregate_count') @@ -36,7 +36,7 @@ class ASNRangeSerializer(OrganizationalModelSerializer): model = ASNRange fields = [ 'id', 'url', 'display_url', 'display', 'name', 'slug', 'rir', 'start', 'end', 'tenant', 'description', - 'owner', 'tags', 'custom_fields', 'created', 'last_updated', 'asn_count', + 'owner', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', 'asn_count', ] brief_fields = ('id', 'url', 'display', 'name', 'description') diff --git a/netbox/ipam/api/serializers_/roles.py b/netbox/ipam/api/serializers_/roles.py index b4fa2c1bc..80a892659 100644 --- a/netbox/ipam/api/serializers_/roles.py +++ b/netbox/ipam/api/serializers_/roles.py @@ -16,7 +16,7 @@ class RoleSerializer(OrganizationalModelSerializer): class Meta: model = Role fields = [ - 'id', 'url', 'display_url', 'display', 'name', 'slug', 'weight', 'description', 'owner', 'tags', + 'id', 'url', 'display_url', 'display', 'name', 'slug', 'weight', 'description', 'owner', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', 'prefix_count', 'vlan_count', ] brief_fields = ('id', 'url', 'display', 'name', 'slug', 'description', 'prefix_count', 'vlan_count') diff --git a/netbox/ipam/api/serializers_/vlans.py b/netbox/ipam/api/serializers_/vlans.py index 133adb12c..871d6eadb 100644 --- a/netbox/ipam/api/serializers_/vlans.py +++ b/netbox/ipam/api/serializers_/vlans.py @@ -45,8 +45,8 @@ class VLANGroupSerializer(OrganizationalModelSerializer): model = VLANGroup fields = [ 'id', 'url', 'display_url', 'display', 'name', 'slug', 'scope_type', 'scope_id', 'scope', 'vid_ranges', - 'tenant', 'description', 'owner', 'tags', 'custom_fields', 'created', 'last_updated', 'vlan_count', - 'utilization', + 'tenant', 'description', 'owner', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', + 'vlan_count', 'utilization', ] brief_fields = ('id', 'url', 'display', 'name', 'slug', 'description', 'vlan_count') validators = [] diff --git a/netbox/ipam/forms/bulk_edit.py b/netbox/ipam/forms/bulk_edit.py index 8a85a908b..b1837cfc1 100644 --- a/netbox/ipam/forms/bulk_edit.py +++ b/netbox/ipam/forms/bulk_edit.py @@ -85,7 +85,7 @@ class RIRBulkEditForm(OrganizationalModelBulkEditForm): fieldsets = ( FieldSet('is_private', 'description'), ) - nullable_fields = ('is_private', 'description') + nullable_fields = ('is_private', 'description', 'comments') class ASNRangeBulkEditForm(OrganizationalModelBulkEditForm): @@ -104,7 +104,7 @@ class ASNRangeBulkEditForm(OrganizationalModelBulkEditForm): fieldsets = ( FieldSet('rir', 'tenant', 'description'), ) - nullable_fields = ('description',) + nullable_fields = ('description', 'comments') class ASNBulkEditForm(PrimaryModelBulkEditForm): @@ -164,7 +164,7 @@ class RoleBulkEditForm(OrganizationalModelBulkEditForm): fieldsets = ( FieldSet('weight', 'description'), ) - nullable_fields = ('description',) + nullable_fields = ('description', 'comments') class PrefixBulkEditForm(ScopedBulkEditForm, PrimaryModelBulkEditForm): @@ -379,7 +379,7 @@ class VLANGroupBulkEditForm(OrganizationalModelBulkEditForm): FieldSet('scope_type', 'scope', name=_('Scope')), FieldSet('tenant', name=_('Tenancy')), ) - nullable_fields = ('description', 'scope') + nullable_fields = ('description', 'scope', 'comments') def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/netbox/ipam/forms/bulk_import.py b/netbox/ipam/forms/bulk_import.py index 7fd01a26f..0e99a6315 100644 --- a/netbox/ipam/forms/bulk_import.py +++ b/netbox/ipam/forms/bulk_import.py @@ -84,7 +84,7 @@ class RIRImportForm(OrganizationalModelImportForm): class Meta: model = RIR - fields = ('name', 'slug', 'is_private', 'description', 'owner', 'tags') + fields = ('name', 'slug', 'is_private', 'description', 'owner', 'comments', 'tags') class AggregateImportForm(PrimaryModelImportForm): @@ -124,7 +124,7 @@ class ASNRangeImportForm(OrganizationalModelImportForm): class Meta: model = ASNRange - fields = ('name', 'slug', 'rir', 'start', 'end', 'tenant', 'description', 'owner', 'tags') + fields = ('name', 'slug', 'rir', 'start', 'end', 'tenant', 'description', 'owner', 'comments', 'tags') class ASNImportForm(PrimaryModelImportForm): @@ -151,7 +151,7 @@ class RoleImportForm(OrganizationalModelImportForm): class Meta: model = Role - fields = ('name', 'slug', 'weight', 'description', 'owner', 'tags') + fields = ('name', 'slug', 'weight', 'description', 'owner', 'comments', 'tags') class PrefixImportForm(ScopedImportForm, PrimaryModelImportForm): @@ -476,7 +476,9 @@ class VLANGroupImportForm(OrganizationalModelImportForm): class Meta: model = VLANGroup - fields = ('name', 'slug', 'scope_type', 'scope_id', 'vid_ranges', 'tenant', 'description', 'owner', 'tags') + fields = ( + 'name', 'slug', 'scope_type', 'scope_id', 'vid_ranges', 'tenant', 'description', 'owner', 'comments', 'tags' + ) labels = { 'scope_id': 'Scope ID', } diff --git a/netbox/ipam/forms/model_forms.py b/netbox/ipam/forms/model_forms.py index f792d1bef..645c3f72e 100644 --- a/netbox/ipam/forms/model_forms.py +++ b/netbox/ipam/forms/model_forms.py @@ -99,7 +99,7 @@ class RIRForm(OrganizationalModelForm): class Meta: model = RIR fields = [ - 'name', 'slug', 'is_private', 'description', 'owner', 'tags', + 'name', 'slug', 'is_private', 'description', 'owner', 'comments', 'tags', ] @@ -139,7 +139,7 @@ class ASNRangeForm(TenancyForm, OrganizationalModelForm): class Meta: model = ASNRange fields = [ - 'name', 'slug', 'rir', 'start', 'end', 'tenant_group', 'tenant', 'owner', 'description', 'tags' + 'name', 'slug', 'rir', 'start', 'end', 'tenant_group', 'tenant', 'owner', 'description', 'comments', 'tags' ] @@ -189,7 +189,7 @@ class RoleForm(OrganizationalModelForm): class Meta: model = Role fields = [ - 'name', 'slug', 'weight', 'description', 'owner', 'tags', + 'name', 'slug', 'weight', 'description', 'owner', 'comments', 'tags', ] @@ -614,7 +614,8 @@ class VLANGroupForm(TenancyForm, OrganizationalModelForm): class Meta: model = VLANGroup fields = [ - 'name', 'slug', 'description', 'vid_ranges', 'scope_type', 'tenant_group', 'tenant', 'owner', 'tags', + 'name', 'slug', 'description', 'vid_ranges', 'scope_type', 'tenant_group', 'tenant', 'owner', 'comments', + 'tags', ] def __init__(self, *args, **kwargs): diff --git a/netbox/ipam/migrations/0085_add_comments_to_organizationalmodel.py b/netbox/ipam/migrations/0085_add_comments_to_organizationalmodel.py new file mode 100644 index 000000000..b7d947350 --- /dev/null +++ b/netbox/ipam/migrations/0085_add_comments_to_organizationalmodel.py @@ -0,0 +1,33 @@ +# Generated by Django 5.2.8 on 2025-12-08 17:38 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ipam', '0084_owner'), + ] + + operations = [ + migrations.AddField( + model_name='asnrange', + name='comments', + field=models.TextField(blank=True), + ), + migrations.AddField( + model_name='rir', + name='comments', + field=models.TextField(blank=True), + ), + migrations.AddField( + model_name='role', + name='comments', + field=models.TextField(blank=True), + ), + migrations.AddField( + model_name='vlangroup', + name='comments', + field=models.TextField(blank=True), + ), + ] diff --git a/netbox/ipam/search.py b/netbox/ipam/search.py index 63437e417..0d11c2cd8 100644 --- a/netbox/ipam/search.py +++ b/netbox/ipam/search.py @@ -31,6 +31,7 @@ class ASNRangeIndex(SearchIndex): fields = ( ('name', 100), ('description', 500), + ('comments', 5000), ) display_attrs = ('rir', 'tenant', 'description') @@ -89,6 +90,7 @@ class RIRIndex(SearchIndex): ('name', 100), ('slug', 110), ('description', 500), + ('comments', 5000), ) display_attrs = ('description',) @@ -100,6 +102,7 @@ class RoleIndex(SearchIndex): ('name', 100), ('slug', 110), ('description', 500), + ('comments', 5000), ) display_attrs = ('description',) @@ -156,6 +159,7 @@ class VLANGroupIndex(SearchIndex): ('name', 100), ('slug', 110), ('description', 500), + ('comments', 5000), ) display_attrs = ('scope_type', 'description') diff --git a/netbox/ipam/tables/asn.py b/netbox/ipam/tables/asn.py index 194778228..b3cec6b5f 100644 --- a/netbox/ipam/tables/asn.py +++ b/netbox/ipam/tables/asn.py @@ -30,8 +30,8 @@ class ASNRangeTable(TenancyColumnsMixin, OrganizationalModelTable): class Meta(OrganizationalModelTable.Meta): model = ASNRange fields = ( - 'pk', 'name', 'slug', 'rir', 'start', 'end', 'asn_count', 'tenant', 'tenant_group', 'description', 'tags', - 'created', 'last_updated', 'actions', + 'pk', 'name', 'slug', 'rir', 'start', 'end', 'asn_count', 'tenant', 'tenant_group', 'description', + 'comments', 'tags', 'created', 'last_updated', 'actions', ) default_columns = ('pk', 'name', 'rir', 'start', 'end', 'tenant', 'asn_count', 'description') diff --git a/netbox/ipam/tables/ip.py b/netbox/ipam/tables/ip.py index c4b29b039..707f7f5be 100644 --- a/netbox/ipam/tables/ip.py +++ b/netbox/ipam/tables/ip.py @@ -48,7 +48,7 @@ class RIRTable(OrganizationalModelTable): class Meta(OrganizationalModelTable.Meta): model = RIR fields = ( - 'pk', 'id', 'name', 'slug', 'is_private', 'aggregate_count', 'description', 'tags', 'created', + 'pk', 'id', 'name', 'slug', 'is_private', 'aggregate_count', 'description', 'comments', 'tags', 'created', 'last_updated', 'actions', ) default_columns = ('pk', 'name', 'is_private', 'aggregate_count', 'description') @@ -126,8 +126,8 @@ class RoleTable(OrganizationalModelTable): class Meta(OrganizationalModelTable.Meta): model = Role fields = ( - 'pk', 'id', 'name', 'slug', 'prefix_count', 'iprange_count', 'vlan_count', 'description', 'weight', 'tags', - 'created', 'last_updated', 'actions', + 'pk', 'id', 'name', 'slug', 'prefix_count', 'iprange_count', 'vlan_count', 'description', 'weight', + 'comments', 'tags', 'created', 'last_updated', 'actions', ) default_columns = ('pk', 'name', 'prefix_count', 'iprange_count', 'vlan_count', 'description') diff --git a/netbox/ipam/tables/vlans.py b/netbox/ipam/tables/vlans.py index b97b13e0e..d125da901 100644 --- a/netbox/ipam/tables/vlans.py +++ b/netbox/ipam/tables/vlans.py @@ -66,7 +66,7 @@ class VLANGroupTable(TenancyColumnsMixin, OrganizationalModelTable): model = VLANGroup fields = ( 'pk', 'id', 'name', 'scope_type', 'scope', 'vid_ranges_list', 'vlan_count', 'slug', 'description', - 'tenant', 'tenant_group', 'tags', 'created', 'last_updated', 'actions', 'utilization', + 'tenant', 'tenant_group', 'comments', 'tags', 'created', 'last_updated', 'actions', 'utilization', ) default_columns = ( 'pk', 'name', 'scope_type', 'scope', 'vlan_count', 'utilization', 'tenant', 'description' diff --git a/netbox/netbox/forms/bulk_edit.py b/netbox/netbox/forms/bulk_edit.py index 5ad95b150..182342106 100644 --- a/netbox/netbox/forms/bulk_edit.py +++ b/netbox/netbox/forms/bulk_edit.py @@ -91,6 +91,7 @@ class OrganizationalModelBulkEditForm(OwnerMixin, NetBoxModelBulkEditForm): max_length=200, required=False ) + comments = CommentField() class NestedGroupModelBulkEditForm(OwnerMixin, NetBoxModelBulkEditForm): diff --git a/netbox/netbox/forms/model_forms.py b/netbox/netbox/forms/model_forms.py index c76dbd77b..49a724201 100644 --- a/netbox/netbox/forms/model_forms.py +++ b/netbox/netbox/forms/model_forms.py @@ -91,6 +91,7 @@ class OrganizationalModelForm(OwnerMixin, NetBoxModelForm): Form for models which inherit from OrganizationalModel. """ slug = SlugField() + comments = CommentField() class NestedGroupModelForm(OwnerMixin, NetBoxModelForm): diff --git a/netbox/netbox/graphql/filter_mixins.py b/netbox/netbox/graphql/filter_mixins.py index cb9fcffe7..9f3122a68 100644 --- a/netbox/netbox/graphql/filter_mixins.py +++ b/netbox/netbox/graphql/filter_mixins.py @@ -58,6 +58,7 @@ class OrganizationalModelFilterMixin( name: FilterLookup[str] | None = strawberry_django.filter_field() slug: FilterLookup[str] | None = strawberry_django.filter_field() description: FilterLookup[str] | None = strawberry_django.filter_field() + comments: FilterLookup[str] | None = strawberry_django.filter_field() @dataclass diff --git a/netbox/netbox/models/__init__.py b/netbox/netbox/models/__init__.py index 1e2846748..496b4c4db 100644 --- a/netbox/netbox/models/__init__.py +++ b/netbox/netbox/models/__init__.py @@ -215,6 +215,10 @@ class OrganizationalModel(OwnerMixin, NetBoxModel): max_length=200, blank=True ) + comments = models.TextField( + verbose_name=_('comments'), + blank=True + ) class Meta: abstract = True diff --git a/netbox/netbox/tables/tables.py b/netbox/netbox/tables/tables.py index 9376c7d64..a2ba13480 100644 --- a/netbox/netbox/tables/tables.py +++ b/netbox/netbox/tables/tables.py @@ -285,6 +285,9 @@ class OrganizationalModelTable(NetBoxTable): linkify=True, verbose_name=_('Owner') ) + comments = columns.MarkdownColumn( + verbose_name=_('Comments'), + ) class NestedGroupModelTable(NetBoxTable): diff --git a/netbox/templates/circuits/circuittype.html b/netbox/templates/circuits/circuittype.html index ae4c17754..a652ab605 100644 --- a/netbox/templates/circuits/circuittype.html +++ b/netbox/templates/circuits/circuittype.html @@ -43,6 +43,7 @@