[PR #12356] [MERGED] 11607 make CableSerializer use WritableNestedSerializer #13951

Closed
opened 2025-12-29 23:21:43 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/12356
Author: @arthanson
Created: 4/26/2023
Status: Merged
Merged: 4/27/2023
Merged by: @jeremystretch

Base: developHead: 11607-custom-field-cable


📝 Commits (1)

  • 5d4ef5e 11607 make CableSerializer WritableNestedSerializer for to_internal value instantiation

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 netbox/dcim/api/nested_serializers.py (+1 -1)

📄 Description

Fixes: #11607

This code (https://github.com/netbox-community/netbox/blob/develop/netbox/extras/api/customfields.py#L86) assumes that the nested serializer gets instantiated after is_valid is called, this occurs for the other NestedSerializers in to_internal_value function in NestedWritableSerializer.

NestedCableSerializer was currently derived from BaseModelSerializer which doesn't do this.

@jeremystretch I'm not aware of any side-effects of deriving from WritableNestedSerializer which only adds this to_internal_value method. Not sure why NestedCableSerializer was different?


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/12356 **Author:** [@arthanson](https://github.com/arthanson) **Created:** 4/26/2023 **Status:** ✅ Merged **Merged:** 4/27/2023 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `11607-custom-field-cable` --- ### 📝 Commits (1) - [`5d4ef5e`](https://github.com/netbox-community/netbox/commit/5d4ef5e9e54d81829f0b74e3f1529c285b8fa223) 11607 make CableSerializer WritableNestedSerializer for to_internal value instantiation ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `netbox/dcim/api/nested_serializers.py` (+1 -1) </details> ### 📄 Description ### Fixes: #11607 This code (https://github.com/netbox-community/netbox/blob/develop/netbox/extras/api/customfields.py#L86) assumes that the nested serializer gets instantiated after is_valid is called, this occurs for the other NestedSerializers in to_internal_value function in NestedWritableSerializer. NestedCableSerializer was currently derived from BaseModelSerializer which doesn't do this. @jeremystretch I'm not aware of any side-effects of deriving from WritableNestedSerializer which only adds this to_internal_value method. Not sure why NestedCableSerializer was different? --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 23:21:43 +01:00
adam closed this issue 2025-12-29 23:21:44 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#13951