Skip to content

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

@jeremystretch

Description

@jeremystretch

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

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the application

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions