[PR #20591] [MERGED] Fixes #20554: Add ContentTypeFilter to several filtersets #15974

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/20591
Author: @pheus
Created: 10/15/2025
Status: Merged
Merged: 10/15/2025
Merged by: @bctiemann

Base: mainHead: 20554-add-missing-contenttypefilter-to-filtersets


📝 Commits (1)

  • f23ee0a feat(filtersets): Add ContentTypeFilter to enhance filtering

📊 Changes

3 files changed (+5 additions, -0 deletions)

View changed files

📝 netbox/core/filtersets.py (+2 -0)
📝 netbox/dcim/filtersets.py (+1 -0)
📝 netbox/ipam/filtersets.py (+2 -0)

📄 Description

Fixes: #20554

Summary
Switch ipam.Service filtering to use ContentTypeFilter for parent_object_type and apply the same approach anywhere we expose a generic relation via filters (e.g., object_type, related_object_type, assigned_object_type). This lets GET filters accept the documented <app>.<model> form (e.g., virtualization.virtualmachine) and aligns GET with POST and existing usability across the app.

What changed

  • Replaced integer-based validation with ContentTypeFilter for parent_object_type in the Services filterset.
  • Standardized on ContentTypeFilter for similar parameters across filtersets where applicable.
  • Added/updated tests to cover filtering via <app>.<model> for the affected params.

Why
Fixes the “Value must be an integer” error when filtering Services by parent_object_type and brings behavior in line with how generic relations are documented and used elsewhere. No database or schema changes.


🔄 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/20591 **Author:** [@pheus](https://github.com/pheus) **Created:** 10/15/2025 **Status:** ✅ Merged **Merged:** 10/15/2025 **Merged by:** [@bctiemann](https://github.com/bctiemann) **Base:** `main` ← **Head:** `20554-add-missing-contenttypefilter-to-filtersets` --- ### 📝 Commits (1) - [`f23ee0a`](https://github.com/netbox-community/netbox/commit/f23ee0a46fdf05cfed2147729eba7c5805d0dd37) feat(filtersets): Add ContentTypeFilter to enhance filtering ### 📊 Changes **3 files changed** (+5 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `netbox/core/filtersets.py` (+2 -0) 📝 `netbox/dcim/filtersets.py` (+1 -0) 📝 `netbox/ipam/filtersets.py` (+2 -0) </details> ### 📄 Description ### Fixes: #20554 **Summary** Switch `ipam.Service` filtering to use `ContentTypeFilter` for `parent_object_type` and apply the same approach anywhere we expose a generic relation via filters (e.g., `object_type`, `related_object_type`, `assigned_object_type`). This lets GET filters accept the documented `<app>.<model>` form (e.g., `virtualization.virtualmachine`) and aligns GET with POST and existing usability across the app. **What changed** - Replaced integer-based validation with `ContentTypeFilter` for `parent_object_type` in the Services filterset. - Standardized on `ContentTypeFilter` for similar parameters across filtersets where applicable. - Added/updated tests to cover filtering via `<app>.<model>` for the affected params. **Why** Fixes the “Value must be an integer” error when filtering Services by `parent_object_type` and brings behavior in line with how generic relations are documented and used elsewhere. No database or schema changes. --- <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:25:06 +01:00
adam closed this issue 2025-12-30 00:25:06 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15974