[PR #5145] [MERGED] 4878 custom fields #12970

Closed
opened 2025-12-29 22:24:39 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/5145
Author: @jeremystretch
Created: 9/17/2020
Status: Merged
Merged: 9/17/2020
Merged by: @jeremystretch

Base: develop-2.10Head: 4878-custom-fields


📝 Commits (10+)

  • 879166d Initial work on reimplementing custom fields
  • 2276603 Drop CustomFieldValue
  • c85a45e Further work on custom fields
  • d9e5adc Update serializer to access custom_field_data directly
  • f7b8d6e Add choices ArrayField to CustomField; drop CustomFieldChoice
  • fb8904a Remove unused attributes, methods
  • 5b3de8d Use DjangoJSONEncoder for encoding custom field data
  • 0b7d019 Remove unused CustomChoiceFieldInspector
  • d0f1c73 Replace CustomFieldsSerializer with CustomFieldsDataField
  • a9086b0 Fix import test

📊 Changes

35 files changed (+579 additions, -751 deletions)

View changed files

📝 docs/administration/netbox-shell.md (+4 -4)
netbox/circuits/migrations/0020_custom_field_data.py (+22 -0)
📝 netbox/circuits/models.py (+0 -11)
netbox/dcim/migrations/0116_custom_field_data.py (+37 -0)
📝 netbox/dcim/models/devices.py (+0 -10)
📝 netbox/dcim/models/power.py (+0 -6)
📝 netbox/dcim/models/racks.py (+0 -5)
📝 netbox/dcim/models/sites.py (+0 -5)
📝 netbox/extras/admin.py (+23 -6)
📝 netbox/extras/api/customfields.py (+31 -101)
📝 netbox/extras/api/urls.py (+0 -3)
📝 netbox/extras/api/views.py (+2 -46)
📝 netbox/extras/filters.py (+15 -32)
📝 netbox/extras/forms.py (+5 -49)
netbox/extras/migrations/0050_customfield_add_choices.py (+35 -0)
netbox/extras/migrations/0051_migrate_customfields.py (+73 -0)
netbox/extras/migrations/0052_delete_customfieldchoice_customfieldvalue.py (+17 -0)
📝 netbox/extras/models/__init__.py (+1 -3)
📝 netbox/extras/models/customfields.py (+50 -156)
📝 netbox/extras/querysets.py (+1 -19)

...and 15 more files

📄 Description

Fixes: #4878

  • Drop the CustomFieldValue and CustomFieldChoice models
  • Add a new custom_field_data JSONField to all models which support custom fields
  • Handle cleanup of stale data upon CustomField deletion

🔄 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/5145 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 9/17/2020 **Status:** ✅ Merged **Merged:** 9/17/2020 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop-2.10` ← **Head:** `4878-custom-fields` --- ### 📝 Commits (10+) - [`879166d`](https://github.com/netbox-community/netbox/commit/879166d939314bdc8745dbede3f8af67c61dd1dd) Initial work on reimplementing custom fields - [`2276603`](https://github.com/netbox-community/netbox/commit/2276603ac386a0c7edfe8a7cb6ad856fd44b392f) Drop CustomFieldValue - [`c85a45e`](https://github.com/netbox-community/netbox/commit/c85a45e5208d21c9b48dd705ecfa6a1e520b548c) Further work on custom fields - [`d9e5adc`](https://github.com/netbox-community/netbox/commit/d9e5adc03270eb225043267b5dd8fcc03168d2b7) Update serializer to access custom_field_data directly - [`f7b8d6e`](https://github.com/netbox-community/netbox/commit/f7b8d6ede5d5c082b4db1dc259f10157ea1a17b4) Add choices ArrayField to CustomField; drop CustomFieldChoice - [`fb8904a`](https://github.com/netbox-community/netbox/commit/fb8904af5476a2624950a708e9bd660a3c5ecc68) Remove unused attributes, methods - [`5b3de8d`](https://github.com/netbox-community/netbox/commit/5b3de8defe125c87cf0d18aeeddf9c91c4446713) Use DjangoJSONEncoder for encoding custom field data - [`0b7d019`](https://github.com/netbox-community/netbox/commit/0b7d019c024823f919bb77aa22f2a1bf1e9487b5) Remove unused CustomChoiceFieldInspector - [`d0f1c73`](https://github.com/netbox-community/netbox/commit/d0f1c733e78c0812c2db9f7ea51d66159d5676f9) Replace CustomFieldsSerializer with CustomFieldsDataField - [`a9086b0`](https://github.com/netbox-community/netbox/commit/a9086b06795e0fdedf4e1614542f101c5b1c670d) Fix import test ### 📊 Changes **35 files changed** (+579 additions, -751 deletions) <details> <summary>View changed files</summary> 📝 `docs/administration/netbox-shell.md` (+4 -4) ➕ `netbox/circuits/migrations/0020_custom_field_data.py` (+22 -0) 📝 `netbox/circuits/models.py` (+0 -11) ➕ `netbox/dcim/migrations/0116_custom_field_data.py` (+37 -0) 📝 `netbox/dcim/models/devices.py` (+0 -10) 📝 `netbox/dcim/models/power.py` (+0 -6) 📝 `netbox/dcim/models/racks.py` (+0 -5) 📝 `netbox/dcim/models/sites.py` (+0 -5) 📝 `netbox/extras/admin.py` (+23 -6) 📝 `netbox/extras/api/customfields.py` (+31 -101) 📝 `netbox/extras/api/urls.py` (+0 -3) 📝 `netbox/extras/api/views.py` (+2 -46) 📝 `netbox/extras/filters.py` (+15 -32) 📝 `netbox/extras/forms.py` (+5 -49) ➕ `netbox/extras/migrations/0050_customfield_add_choices.py` (+35 -0) ➕ `netbox/extras/migrations/0051_migrate_customfields.py` (+73 -0) ➕ `netbox/extras/migrations/0052_delete_customfieldchoice_customfieldvalue.py` (+17 -0) 📝 `netbox/extras/models/__init__.py` (+1 -3) 📝 `netbox/extras/models/customfields.py` (+50 -156) 📝 `netbox/extras/querysets.py` (+1 -19) _...and 15 more files_ </details> ### 📄 Description ### Fixes: #4878 - Drop the CustomFieldValue and CustomFieldChoice models - Add a new `custom_field_data` JSONField to all models which support custom fields - Handle cleanup of stale data upon CustomField deletion --- <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 22:24:39 +01:00
adam closed this issue 2025-12-29 22:24:39 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#12970