Filtering by content type should support specifying app and model name #3893

Closed
opened 2025-12-29 18:31:50 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Jul 24, 2020).

Originally assigned to: @jeremystretch on GitHub.

Environment

  • Python version: 3.6.9
  • NetBox version: 2.8.8

Proposed Functionality

Support filtering on ContentType foreign key fields by the model's human-friendly label in addition to its numeric ID. For example, both of the following should return the same results:

GET /api/extras/object-changes/?changed_object_type=dcim.Device
GET /api/extras/object-changes/?changed_object_type_id=48  # Or whatever the correct ID is for the type

This was originally raised under #4431 for ObjectChanges, however there are several instances in NetBox where this change is needed, including:

  • dcim.Cable
  • extras.ImageAttachment
  • extras.ObjectChange
  • ipam.IPAddress (v2.9+)
  • users.ObjectPermission (v2.9+)

Use Case

Allows a user to filter by related object type without needing to first look up the type's unique ID.

Database Changes

None

External Dependencies

None

Originally created by @jeremystretch on GitHub (Jul 24, 2020). Originally assigned to: @jeremystretch on GitHub. ### Environment * Python version: 3.6.9 * NetBox version: 2.8.8 ### Proposed Functionality Support filtering on ContentType foreign key fields by the model's human-friendly label in addition to its numeric ID. For example, both of the following should return the same results: ``` GET /api/extras/object-changes/?changed_object_type=dcim.Device GET /api/extras/object-changes/?changed_object_type_id=48 # Or whatever the correct ID is for the type ``` This was originally raised under #4431 for ObjectChanges, however there are several instances in NetBox where this change is needed, including: * dcim.Cable * extras.ImageAttachment * extras.ObjectChange * ipam.IPAddress (v2.9+) * users.ObjectPermission (v2.9+) ### Use Case Allows a user to filter by related object type without needing to first look up the type's unique ID. ### Database Changes None ### External Dependencies None
adam added the status: acceptedtype: feature labels 2025-12-29 18:31:50 +01:00
adam closed this issue 2025-12-29 18:31:50 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3893