Include child locations in rack/device lists for location floorplans - #103
Open
bpapaylle wants to merge 1 commit into
Open
Include child locations in rack/device lists for location floorplans#103bpapaylle wants to merge 1 commit into
bpapaylle wants to merge 1 commit into
Conversation
A floorplan attached to a parent location previously offered no racks or devices to place when they are assigned to its child locations, which is the common case for a datacenter location split into rooms/rows. Filter on the location's descendants (including itself) instead of an exact location match. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
bpapaylle
force-pushed
the
fix/location-descendants
branch
from
July 14, 2026 09:36
8a9976a to
e149e69
Compare
Member
|
Interesting tested on NetBox 5.0.1 - given that doesn't exist. |
Author
|
it's a typo my bad, it was tested on the following docker image netboxcommunity/netbox:v4.6.2-5.0.1, that is where the 5.0.1 is coming from. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a floorplan is attached to a parent location, the rack and device
pick-lists in the editor filter on an exact location match
(
location=fp_instance.location.id). Racks are usually assigned to leaflocations (rooms, rows), so a floorplan on the parent location offers
nothing to place.
Typical case: a datacenter location split into several room locations,
with every rack assigned to a room. The datacenter-level floorplan shows
an empty rack list, making a global datacenter view impossible.
Solution
Filter on the location's descendants instead of an exact match, in both
FloorplanRackListViewandFloorplanDeviceListView:Locationis a tree model, soget_descendants(include_self=True)isavailable natively. Leaf locations keep the exact same behaviour as
before (
include_self=True, no descendants), so this is strictlyadditive: only parent-location floorplans gain the racks/devices of
their children.
Tested
On NetBox 5.0.1, with a parent location whose racks all live in child
locations: before the change, the parent-location floorplan offered no
racks at all; after, every rack from the child locations is offered,
and child-location floorplans behave exactly as before.
🤖 Generated with Claude Code