[PR #11449] [MERGED] Fixes #11431 - Disallow changing customfield type after creation #13789

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/11449
Author: @kkthxbye-code
Created: 1/10/2023
Status: Merged
Merged: 4/10/2023
Merged by: @jeremystretch

Base: developHead: 11431-disallow-cf-type-edit


📝 Commits (2)

  • 28cad7c Disallow changing customfield type after creation
  • 011b8cf Fix test_api.CustomFieldTest

📊 Changes

3 files changed (+18 additions, -0 deletions)

View changed files

📝 netbox/extras/api/serializers.py (+6 -0)
📝 netbox/extras/forms/model_forms.py (+7 -0)
📝 netbox/extras/tests/test_api.py (+5 -0)

📄 Description

Fixes: #11431

For the API this is the simplest fix. I played around with dynamically choosing another serializer based on the action, but I couldn't get it working properly. Not sure if there's any good solution for omitting the type field in the put/patch in the swagger definition?


🔄 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/11449 **Author:** [@kkthxbye-code](https://github.com/kkthxbye-code) **Created:** 1/10/2023 **Status:** ✅ Merged **Merged:** 4/10/2023 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `11431-disallow-cf-type-edit` --- ### 📝 Commits (2) - [`28cad7c`](https://github.com/netbox-community/netbox/commit/28cad7c2f9aae6c2707aa01c67726f18dd796f1c) Disallow changing customfield type after creation - [`011b8cf`](https://github.com/netbox-community/netbox/commit/011b8cf4832a1f2146acbf6031897a5cbe4bc77c) Fix test_api.CustomFieldTest ### 📊 Changes **3 files changed** (+18 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `netbox/extras/api/serializers.py` (+6 -0) 📝 `netbox/extras/forms/model_forms.py` (+7 -0) 📝 `netbox/extras/tests/test_api.py` (+5 -0) </details> ### 📄 Description ### Fixes: #11431 For the API this is the simplest fix. I played around with dynamically choosing another serializer based on the action, but I couldn't get it working properly. Not sure if there's any good solution for omitting the type field in the put/patch in the swagger definition? --- <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:20:48 +01:00
adam closed this issue 2025-12-29 23:20:48 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#13789