[PR #9411] [MERGED] Fixes #9166 - Add the option to make custom fields read-only or hidden in UI #13461

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/9411
Author: @kkthxbye-code
Created: 5/24/2022
Status: Merged
Merged: 5/24/2022
Merged by: @jeremystretch

Base: featureHead: fix-9166-2


📝 Commits (3)

  • 20eaa7d #9166 - Add UI Visibility setting for custom fields
  • c14a2a0 Exclude hidden custom fields from tables
  • 6e7c5dc Remove whitespace from blank line

📊 Changes

15 files changed (+89 additions, -14 deletions)

View changed files

📝 netbox/extras/api/serializers.py (+2 -1)
📝 netbox/extras/choices.py (+13 -0)
📝 netbox/extras/filtersets.py (+3 -1)
📝 netbox/extras/forms/bulk_edit.py (+7 -0)
📝 netbox/extras/forms/bulk_import.py (+1 -1)
📝 netbox/extras/forms/customfields.py (+7 -0)
📝 netbox/extras/forms/filtersets.py (+7 -1)
📝 netbox/extras/forms/models.py (+2 -1)
netbox/extras/migrations/0075_customfield_ui_visibility.py (+18 -0)
📝 netbox/extras/models/customfields.py (+6 -0)
📝 netbox/extras/tables/tables.py (+2 -1)
📝 netbox/extras/tests/test_views.py (+5 -4)
📝 netbox/netbox/models/features.py (+7 -3)
📝 netbox/netbox/tables/tables.py (+5 -1)
📝 netbox/templates/extras/customfield.html (+4 -0)

📄 Description

Fixes: #9166

Provides 3 visibility options:

  • Read/Write (Default)
  • Read-only
  • Hidden

Read/Write is the current behavior.

Read-only shows the value as normal on objects, but makes the form field disabled on create/edit forms.

Hidden hides the field completely in the UI.

No changes to how custom fields are displayed in the API. There is no form validation if the user were to edit the form to remove the disabled option. I didn't see it as necessary as the visibility is not a security feature.

Please let me know if I missed something.


🔄 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/9411 **Author:** [@kkthxbye-code](https://github.com/kkthxbye-code) **Created:** 5/24/2022 **Status:** ✅ Merged **Merged:** 5/24/2022 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `feature` ← **Head:** `fix-9166-2` --- ### 📝 Commits (3) - [`20eaa7d`](https://github.com/netbox-community/netbox/commit/20eaa7d069b20bc8b123ef270ffd4ba3ea410105) #9166 - Add UI Visibility setting for custom fields - [`c14a2a0`](https://github.com/netbox-community/netbox/commit/c14a2a0a392b2dc408e9d08ffc92db1ca0911d81) Exclude hidden custom fields from tables - [`6e7c5dc`](https://github.com/netbox-community/netbox/commit/6e7c5dcaede247b9e65a9b22cf372ef5df59dab4) Remove whitespace from blank line ### 📊 Changes **15 files changed** (+89 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `netbox/extras/api/serializers.py` (+2 -1) 📝 `netbox/extras/choices.py` (+13 -0) 📝 `netbox/extras/filtersets.py` (+3 -1) 📝 `netbox/extras/forms/bulk_edit.py` (+7 -0) 📝 `netbox/extras/forms/bulk_import.py` (+1 -1) 📝 `netbox/extras/forms/customfields.py` (+7 -0) 📝 `netbox/extras/forms/filtersets.py` (+7 -1) 📝 `netbox/extras/forms/models.py` (+2 -1) ➕ `netbox/extras/migrations/0075_customfield_ui_visibility.py` (+18 -0) 📝 `netbox/extras/models/customfields.py` (+6 -0) 📝 `netbox/extras/tables/tables.py` (+2 -1) 📝 `netbox/extras/tests/test_views.py` (+5 -4) 📝 `netbox/netbox/models/features.py` (+7 -3) 📝 `netbox/netbox/tables/tables.py` (+5 -1) 📝 `netbox/templates/extras/customfield.html` (+4 -0) </details> ### 📄 Description ### Fixes: #9166 Provides 3 visibility options: * Read/Write (Default) * Read-only * Hidden Read/Write is the current behavior. Read-only shows the value as normal on objects, but makes the form field disabled on create/edit forms. Hidden hides the field completely in the UI. No changes to how custom fields are displayed in the API. There is no form validation if the user were to edit the form to remove the disabled option. I didn't see it as necessary as the visibility is not a security feature. Please let me know if I missed something. --- <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:18:58 +01:00
adam closed this issue 2025-12-29 23:18:58 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#13461