[PR #14095] [MERGED] Closes #13381: Enable plugins to register custom data backends #14312

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/14095
Author: @jeremystretch
Created: 10/20/2023
Status: Merged
Merged: 10/24/2023
Merged by: @jeremystretch

Base: featureHead: 13381-register-data-backends


📝 Commits (6)

📊 Changes

23 files changed (+250 additions, -113 deletions)

View changed files

docs/plugins/development/data-backends.md (+23 -0)
📝 docs/plugins/development/index.md (+1 -0)
📝 mkdocs.yml (+1 -0)
📝 netbox/core/api/serializers.py (+2 -1)
📝 netbox/core/choices.py (+0 -12)
📝 netbox/core/data_backends.py (+13 -46)
📝 netbox/core/filtersets.py (+2 -1)
📝 netbox/core/forms/bulk_edit.py (+3 -5)
📝 netbox/core/forms/filtersets.py (+2 -1)
📝 netbox/core/forms/model_forms.py (+12 -7)
netbox/core/migrations/0006_datasource_type_remove_choices.py (+18 -0)
📝 netbox/core/models/data.py (+11 -10)
netbox/core/tables/columns.py (+20 -0)
📝 netbox/core/tables/data.py (+5 -4)
📝 netbox/core/tests/test_api.py (+7 -8)
📝 netbox/core/tests/test_filtersets.py (+7 -7)
📝 netbox/core/tests/test_views.py (+9 -10)
netbox/netbox/data_backends.py (+53 -0)
📝 netbox/netbox/plugins/__init__.py (+8 -0)
netbox/netbox/tests/dummy_plugin/data_backends.py (+18 -0)

...and 3 more files

📄 Description

Fixes: #13381

  • Move base DataBackend class from core to netbox
  • Remove static choices for DataSource.type
  • Validate DataSource.type against registered backends
  • Move register_backend() wrapper to core.utils
  • Introduce get_data_backend_choices() utility function
  • Add a data_backends attribute to PluginConfig
  • Establish name, label, and is_local attributes on DataBackend
  • Remove colors from DataSource types

🔄 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/14095 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 10/20/2023 **Status:** ✅ Merged **Merged:** 10/24/2023 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `feature` ← **Head:** `13381-register-data-backends` --- ### 📝 Commits (6) - [`21d17d5`](https://github.com/netbox-community/netbox/commit/21d17d5891eeacf4eab3177ca625e9a9a7b53484) Initial work on #13381 - [`ec098da`](https://github.com/netbox-community/netbox/commit/ec098da4b94bee3c68d49141ebc7bee9fc41e22c) Fix backend type display in table column - [`9902e2c`](https://github.com/netbox-community/netbox/commit/9902e2c36d171c6557871979d0f8e938478bf5e0) Fix data source type choices during bulk edit - [`2a8cc60`](https://github.com/netbox-community/netbox/commit/2a8cc60aa401957ef01746dd2dae235c134ae767) Misc cleanup - [`409903d`](https://github.com/netbox-community/netbox/commit/409903d0179d63ab8fb8a313d7f0c12b4080a76e) Move backend utils from core app to netbox - [`6e58c48`](https://github.com/netbox-community/netbox/commit/6e58c480ee7075a6beb114418d8607378b3736d9) Move backend type validation from serializer to model ### 📊 Changes **23 files changed** (+250 additions, -113 deletions) <details> <summary>View changed files</summary> ➕ `docs/plugins/development/data-backends.md` (+23 -0) 📝 `docs/plugins/development/index.md` (+1 -0) 📝 `mkdocs.yml` (+1 -0) 📝 `netbox/core/api/serializers.py` (+2 -1) 📝 `netbox/core/choices.py` (+0 -12) 📝 `netbox/core/data_backends.py` (+13 -46) 📝 `netbox/core/filtersets.py` (+2 -1) 📝 `netbox/core/forms/bulk_edit.py` (+3 -5) 📝 `netbox/core/forms/filtersets.py` (+2 -1) 📝 `netbox/core/forms/model_forms.py` (+12 -7) ➕ `netbox/core/migrations/0006_datasource_type_remove_choices.py` (+18 -0) 📝 `netbox/core/models/data.py` (+11 -10) ➕ `netbox/core/tables/columns.py` (+20 -0) 📝 `netbox/core/tables/data.py` (+5 -4) 📝 `netbox/core/tests/test_api.py` (+7 -8) 📝 `netbox/core/tests/test_filtersets.py` (+7 -7) 📝 `netbox/core/tests/test_views.py` (+9 -10) ➕ `netbox/netbox/data_backends.py` (+53 -0) 📝 `netbox/netbox/plugins/__init__.py` (+8 -0) ➕ `netbox/netbox/tests/dummy_plugin/data_backends.py` (+18 -0) _...and 3 more files_ </details> ### 📄 Description ### Fixes: #13381 - Move base DataBackend class from `core` to `netbox` - Remove static choices for `DataSource.type` - Validate `DataSource.type` against registered backends - Move `register_backend()` wrapper to `core.utils` - Introduce `get_data_backend_choices()` utility function - Add a `data_backends` attribute to PluginConfig - Establish `name`, `label`, and `is_local` attributes on DataBackend - Remove colors from DataSource types --- <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:23:45 +01:00
adam closed this issue 2025-12-29 23:23:45 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#14312