[PR #10597] [MERGED] #9072: Custom model view tabs for plugins #13659

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/10597
Author: @jeremystretch
Created: 10/6/2022
Status: Merged
Merged: 10/7/2022
Merged by: @jeremystretch

Base: featureHead: 9072-plugin-view-tabs


📝 Commits (7)

📊 Changes

33 files changed (+659 additions, -637 deletions)

View changed files

📝 docs/plugins/development/views.md (+26 -0)
📝 docs/release-notes/version-3.4.md (+1 -0)
📝 netbox/circuits/urls.py (+7 -10)
📝 netbox/dcim/urls.py (+35 -75)
📝 netbox/dcim/views.py (+237 -55)
📝 netbox/extras/registry.py (+1 -0)
📝 netbox/extras/tests/dummy_plugin/views.py (+9 -0)
📝 netbox/extras/tests/test_plugins.py (+11 -0)
📝 netbox/extras/urls.py (+10 -17)
📝 netbox/extras/views.py (+0 -1)
📝 netbox/ipam/urls.py (+19 -39)
📝 netbox/ipam/views.py (+44 -19)
📝 netbox/netbox/models/features.py (+15 -0)
📝 netbox/netbox/views/generic/feature_views.py (+13 -2)
📝 netbox/netbox/views/generic/object_views.py (+7 -1)
📝 netbox/templates/dcim/device/base.html (+0 -110)
📝 netbox/templates/dcim/devicetype/base.html (+0 -82)
📝 netbox/templates/dcim/moduletype/base.html (+0 -58)
📝 netbox/templates/generic/object.html (+5 -27)
📝 netbox/templates/ipam/aggregate/base.html (+0 -10)

...and 13 more files

📄 Description

Closes: #9072

  • Establish a new views registry root
  • Introduce register_model_view() for registering arbitrary views for core models, optionally with tab details for UI rendering
  • Introduce get_model_urls() utility function for creating URL path entries from registered views
  • Automatically register the appropriate views for models inheriting from JournalingMixin and/or ChangeLoggingMixin
  • Add a model_view_tabs template tag for rendering the tabs of registered views
  • Replace legacy template cruft for journal/changelog tabs with model_view_tabs
  • Replace all the static journaling and changelog URL paths with the dynamic resolution mechanism
  • Introduce ViewTab class for registering tabs
  • Extend plugins tests & docs

🔄 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/10597 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 10/6/2022 **Status:** ✅ Merged **Merged:** 10/7/2022 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `feature` ← **Head:** `9072-plugin-view-tabs` --- ### 📝 Commits (7) - [`0d7851e`](https://github.com/netbox-community/netbox/commit/0d7851ed9de2792ea6d9ed223c315c235290ddd7) #9072: Implement a mechanism for dynamically registering model detail views - [`a0bae06`](https://github.com/netbox-community/netbox/commit/a0bae06ff7fb6071dc90acdc6035f0897b94b194) Replace static journaling, changelog URL paths with dynamic resolution - [`4c999da`](https://github.com/netbox-community/netbox/commit/4c999daacd94588ef328d4b663319970cf82131a) Introduce ViewTab - [`bfe26b4`](https://github.com/netbox-community/netbox/commit/bfe26b46a6a0bb93bfcf8d16fe088e61d3d51295) Wrap model detail views with register_model_view() - [`5e1a073`](https://github.com/netbox-community/netbox/commit/5e1a0733e4b439137e2e671b9b7404375db70809) Replace active_tab context for object views - [`1fc8de8`](https://github.com/netbox-community/netbox/commit/1fc8de85a354ad814ce278838fb56105937f4978) Add device NAPALM view tabs - [`053c97b`](https://github.com/netbox-community/netbox/commit/053c97b7a8e0ef20fda3873108d981c92a129984) Docs and test for #9072 ### 📊 Changes **33 files changed** (+659 additions, -637 deletions) <details> <summary>View changed files</summary> 📝 `docs/plugins/development/views.md` (+26 -0) 📝 `docs/release-notes/version-3.4.md` (+1 -0) 📝 `netbox/circuits/urls.py` (+7 -10) 📝 `netbox/dcim/urls.py` (+35 -75) 📝 `netbox/dcim/views.py` (+237 -55) 📝 `netbox/extras/registry.py` (+1 -0) 📝 `netbox/extras/tests/dummy_plugin/views.py` (+9 -0) 📝 `netbox/extras/tests/test_plugins.py` (+11 -0) 📝 `netbox/extras/urls.py` (+10 -17) 📝 `netbox/extras/views.py` (+0 -1) 📝 `netbox/ipam/urls.py` (+19 -39) 📝 `netbox/ipam/views.py` (+44 -19) 📝 `netbox/netbox/models/features.py` (+15 -0) 📝 `netbox/netbox/views/generic/feature_views.py` (+13 -2) 📝 `netbox/netbox/views/generic/object_views.py` (+7 -1) 📝 `netbox/templates/dcim/device/base.html` (+0 -110) 📝 `netbox/templates/dcim/devicetype/base.html` (+0 -82) 📝 `netbox/templates/dcim/moduletype/base.html` (+0 -58) 📝 `netbox/templates/generic/object.html` (+5 -27) 📝 `netbox/templates/ipam/aggregate/base.html` (+0 -10) _...and 13 more files_ </details> ### 📄 Description ### Closes: #9072 - Establish a new `views` registry root - Introduce `register_model_view()` for registering arbitrary views for core models, optionally with tab details for UI rendering - Introduce `get_model_urls()` utility function for creating URL path entries from registered views - Automatically register the appropriate views for models inheriting from `JournalingMixin` and/or `ChangeLoggingMixin` - Add a `model_view_tabs` template tag for rendering the tabs of registered views - Replace legacy template cruft for journal/changelog tabs with `model_view_tabs` - Replace all the static journaling and changelog URL paths with the dynamic resolution mechanism - Introduce ViewTab class for registering tabs - Extend plugins tests & docs --- <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:07 +01:00
adam closed this issue 2025-12-29 23:20:07 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#13659