Skip to content

Conversation

@pheus
Copy link
Contributor

@pheus pheus commented Apr 14, 2025

Fixes #19056 – Add Device filtering by Location slug

Overview

This PR enhances the Device API by allowing devices to be filtered by the slug of their assigned location, in addition to the existing ID-based filtering.

Changes

  • DCIM FilterSet: Added the location filter to support lookup by slug.
  • Tests: Added unit tests to verify slug-based filtering functionality for locations.

This improves API usability for clients relying on human-readable slugs instead of numeric IDs.

Thanks for your time!

pheus added 2 commits April 13, 2025 14:50
Introduces a TreeNodeMultipleChoiceFilter for filtering locations by
slug. Enhances filtering flexibility in the Device model by supporting
both ID and slug lookups.

Fixes netbox-community#19056
Extend test cases to include filtering by location slug. Ensures the
FilterSet works correctly with slug-based queries for locations.

Fixes netbox-community#19056
@pheus pheus changed the title Fixes #19056 – Add Device filtering by location slug Fixes #19056 – Add Device filtering by Location slug Apr 14, 2025
@jeremystretch jeremystretch self-requested a review April 15, 2025 12:18
Copy link
Member

@jeremystretch jeremystretch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @pheus!

@jeremystretch jeremystretch merged commit 44cb1a9 into netbox-community:main Apr 15, 2025
6 checks passed
@pheus pheus deleted the 19056-add-device-filtering-by-location-slug branch April 15, 2025 15:49
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add location by slug to device filterset

2 participants