From 80a3bb21fec67fd76d3cd52023ff52b1ebefa17a Mon Sep 17 00:00:00 2001 From: Arthur Date: Mon, 8 Sep 2025 10:40:56 -0700 Subject: [PATCH 1/3] 104 fix bulk edit form --- netbox_custom_objects/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/netbox_custom_objects/views.py b/netbox_custom_objects/views.py index 1532923..97f3f13 100644 --- a/netbox_custom_objects/views.py +++ b/netbox_custom_objects/views.py @@ -628,6 +628,9 @@ def get_form(self, queryset): (NetBoxModelBulkEditForm,), attrs, ) + + # Set the model attribute that NetBox form mixins expect + form.model = queryset.model return form From bcaf548c60a246df16de3f34820d55ef246e338e Mon Sep 17 00:00:00 2001 From: Arthur Date: Mon, 8 Sep 2025 11:05:36 -0700 Subject: [PATCH 2/3] fix serializer error on form submit --- netbox_custom_objects/api/serializers.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/netbox_custom_objects/api/serializers.py b/netbox_custom_objects/api/serializers.py index c13ce5b..1be32e3 100644 --- a/netbox_custom_objects/api/serializers.py +++ b/netbox_custom_objects/api/serializers.py @@ -211,7 +211,16 @@ def get_serializer_class(model, skip_object_fields=False): # Create field list including all necessary fields base_fields = ["id", "url", "display", "created", "last_updated", "tags"] - custom_field_names = [field.name for field in model_fields] + + # Only include custom field names that will actually be added to the serializer + custom_field_names = [] + for field in model_fields: + if skip_object_fields and field.type in [ + CustomFieldTypeChoices.TYPE_OBJECT, CustomFieldTypeChoices.TYPE_MULTIOBJECT + ]: + continue + custom_field_names.append(field.name) + all_fields = base_fields + custom_field_names meta = type( From 9a841a56e4c22d9e7204aef781f5656cead51c57 Mon Sep 17 00:00:00 2001 From: Arthur Date: Tue, 9 Sep 2025 13:34:03 -0700 Subject: [PATCH 3/3] fix ruff --- netbox_custom_objects/api/serializers.py | 4 ++-- netbox_custom_objects/views.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/netbox_custom_objects/api/serializers.py b/netbox_custom_objects/api/serializers.py index 1be32e3..69aa67f 100644 --- a/netbox_custom_objects/api/serializers.py +++ b/netbox_custom_objects/api/serializers.py @@ -211,7 +211,7 @@ def get_serializer_class(model, skip_object_fields=False): # Create field list including all necessary fields base_fields = ["id", "url", "display", "created", "last_updated", "tags"] - + # Only include custom field names that will actually be added to the serializer custom_field_names = [] for field in model_fields: @@ -220,7 +220,7 @@ def get_serializer_class(model, skip_object_fields=False): ]: continue custom_field_names.append(field.name) - + all_fields = base_fields + custom_field_names meta = type( diff --git a/netbox_custom_objects/views.py b/netbox_custom_objects/views.py index 97f3f13..3ac9e82 100644 --- a/netbox_custom_objects/views.py +++ b/netbox_custom_objects/views.py @@ -628,7 +628,7 @@ def get_form(self, queryset): (NetBoxModelBulkEditForm,), attrs, ) - + # Set the model attribute that NetBox form mixins expect form.model = queryset.model