[PR #18826] [MERGED] Prefetch interface data for REST API on netbox 4.2 #15446

Closed
opened 2025-12-30 00:21:58 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/18826
Author: @Tishka17
Created: 3/6/2025
Status: Merged
Merged: 3/12/2025
Merged by: @bctiemann

Base: mainHead: fix/generic_prefetch_4.2


📝 Commits (10+)

  • 8dc1d68 port generic field to 4.2
  • 7794c6c Fix link peers
  • 9c3e7f2 Cleanup
  • 83ca0ef Add missed init
  • 5c88317 cleanup unused imports and extra line
  • d226af4 Merge branch 'develop' into fix/generic_prefetch_4.2
  • 741645c Merge branch 'develop' into fix/generic_prefetch_4.2
  • d103e13 Removed automatic cache invalidation
  • 7d64d3b Move GenericArrayForeignKey to fields module
  • cdd2536 Merge branch 'main' into fix/generic_prefetch_4.2

📊 Changes

4 files changed (+161 additions, -48 deletions)

View changed files

📝 netbox/dcim/api/views.py (+13 -1)
📝 netbox/dcim/models/cables.py (+11 -45)
📝 netbox/dcim/models/device_components.py (+5 -2)
📝 netbox/utilities/fields.py (+132 -0)

📄 Description

Fixes: #18409

  • Do not do additional requests for CabledObjectModel.link_peers
  • Custom field for arrays containing generic foreign keys
  • Use custom field instead of CablePath._get_path method
  • Enable prefetching for interface _path and cable

🔄 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/18826 **Author:** [@Tishka17](https://github.com/Tishka17) **Created:** 3/6/2025 **Status:** ✅ Merged **Merged:** 3/12/2025 **Merged by:** [@bctiemann](https://github.com/bctiemann) **Base:** `main` ← **Head:** `fix/generic_prefetch_4.2` --- ### 📝 Commits (10+) - [`8dc1d68`](https://github.com/netbox-community/netbox/commit/8dc1d68aee04ef51e2f17f381fa7129a0787cc7e) port generic field to 4.2 - [`7794c6c`](https://github.com/netbox-community/netbox/commit/7794c6cfcb236b57ec46207a86946434958e5dcf) Fix link peers - [`9c3e7f2`](https://github.com/netbox-community/netbox/commit/9c3e7f2c5d0f11dcd8227c7d4eb2655f3431bbe7) Cleanup - [`83ca0ef`](https://github.com/netbox-community/netbox/commit/83ca0ef95559f00fe029cf1724d075518d4ae441) Add missed init - [`5c88317`](https://github.com/netbox-community/netbox/commit/5c8831774591d8e63829db7a648a4ea9a010f985) cleanup unused imports and extra line - [`d226af4`](https://github.com/netbox-community/netbox/commit/d226af420b8696608128d14829e4c46b79cd6ed4) Merge branch 'develop' into fix/generic_prefetch_4.2 - [`741645c`](https://github.com/netbox-community/netbox/commit/741645c9f746ff0de0f6d783cfc62f14678c7476) Merge branch 'develop' into fix/generic_prefetch_4.2 - [`d103e13`](https://github.com/netbox-community/netbox/commit/d103e13732a8c4b38b353ac9dd345a950822fc78) Removed automatic cache invalidation - [`7d64d3b`](https://github.com/netbox-community/netbox/commit/7d64d3b5ed07cb845f46d948a57d82f12810ec21) Move GenericArrayForeignKey to fields module - [`cdd2536`](https://github.com/netbox-community/netbox/commit/cdd25368e7568763be8daf717731dce925a05936) Merge branch 'main' into fix/generic_prefetch_4.2 ### 📊 Changes **4 files changed** (+161 additions, -48 deletions) <details> <summary>View changed files</summary> 📝 `netbox/dcim/api/views.py` (+13 -1) 📝 `netbox/dcim/models/cables.py` (+11 -45) 📝 `netbox/dcim/models/device_components.py` (+5 -2) 📝 `netbox/utilities/fields.py` (+132 -0) </details> ### 📄 Description <!-- Thank you for your interest in contributing to NetBox! Please note that our contribution policy requires that a feature request or bug report be approved and assigned prior to opening a pull request. This helps avoid waste time and effort on a proposed change that we might not be able to accept. IF YOUR PULL REQUEST DOES NOT REFERENCE AN ISSUE WHICH HAS BEEN ASSIGNED TO YOU, IT WILL BE CLOSED AUTOMATICALLY. Please specify your assigned issue number on the line below. --> ### Fixes: #18409 * Do not do additional requests for `CabledObjectModel.link_peers` * Custom field for arrays containing generic foreign keys * Use custom field instead of `CablePath._get_path` method * Enable prefetching for interface `_path` and `cable` --- <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-30 00:21:58 +01:00
adam closed this issue 2025-12-30 00:21: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#15446