[PR #18704] [MERGED] Fixes 18095: inherit contacts #15420

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/18704
Author: @alehaa
Created: 2/22/2025
Status: Merged
Merged: 2/25/2025
Merged by: @bctiemann

Base: featureHead: 18095-inherit-contacts


📝 Commits (5)

  • 701f40e Show parent contacts for nested models
  • d5316de Move contact queryset into model
  • 72adda1 Allow exclusion of inherited contacts
  • ca6b686 Limit inherited contacts to model
  • effc23f Optimize contact lookup query

📊 Changes

2 files changed (+23 additions, -14 deletions)

View changed files

📝 netbox/netbox/models/features.py (+21 -0)
📝 netbox/tenancy/views.py (+2 -14)

📄 Description

Fixes: #18095

Contacts for a NestedGroupModel will also include the contact assignments of the parents.

While at first it seemed tempting to include other related contact assignments (e.g. for a Location those of a Site), this is much more complicated than expected. The code proposed in this PR can also handle these relationships by iterating over related objects and adding constraints to the filter. In practice, however, it remains unclear which relationships are important to users, as these may vary between different NetBox deployments and even within a single deployment. In this case, I suggest opening a new FR with details of a possible lookup logic and adding it to get_contacts().


🔄 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/18704 **Author:** [@alehaa](https://github.com/alehaa) **Created:** 2/22/2025 **Status:** ✅ Merged **Merged:** 2/25/2025 **Merged by:** [@bctiemann](https://github.com/bctiemann) **Base:** `feature` ← **Head:** `18095-inherit-contacts` --- ### 📝 Commits (5) - [`701f40e`](https://github.com/netbox-community/netbox/commit/701f40e2a8e46ebcf8bf11707f1c418bbc06c9c8) Show parent contacts for nested models - [`d5316de`](https://github.com/netbox-community/netbox/commit/d5316de9c84daf258b43af002e1f156ac41c18cb) Move contact queryset into model - [`72adda1`](https://github.com/netbox-community/netbox/commit/72adda11974f81fbc0cc9edfc74654009c74b1b9) Allow exclusion of inherited contacts - [`ca6b686`](https://github.com/netbox-community/netbox/commit/ca6b686b88ac68550712adf74b4f68cbcac3f8ee) Limit inherited contacts to model - [`effc23f`](https://github.com/netbox-community/netbox/commit/effc23f5bbd1223398421aa99bb760a11da37be7) Optimize contact lookup query ### 📊 Changes **2 files changed** (+23 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `netbox/netbox/models/features.py` (+21 -0) 📝 `netbox/tenancy/views.py` (+2 -14) </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: #18095 <!-- Please include a summary of the proposed changes below. --> Contacts for a `NestedGroupModel` will also include the contact assignments of the parents. While at first it seemed tempting to include other related contact assignments (e.g. for a `Location` those of a `Site`), this is much more complicated than expected. The code proposed in this PR can also handle these relationships by iterating over related objects and adding constraints to the `filter`. In practice, however, it remains unclear which relationships are important to users, as these may vary between different NetBox deployments and even within a single deployment. In this case, I suggest opening a new FR with details of a possible lookup logic and adding it to `get_contacts()`. --- <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:49 +01:00
adam closed this issue 2025-12-30 00:21:49 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15420