Skip to content

Fitlers for ChoiceFields should support multiple values #6162

@jeremystretch

Description

@jeremystretch

NetBox version

v2.10.9

Python version

3.7

Steps to Reproduce

I've identified several filters for static choice fields on models which do not support passing multiple values. These are:

  • FrontPort.type
  • FrontPortTemplate.type
  • InterfaceTemplate.type
  • PowerFeed.status
  • PowerOutlet.feed_leg
  • PowerOutletTemplate.feed_leg
  • RearPort.type
  • RearPortTemplate.type

For example, create three power outlet templates on a device type, assigning one to each feed leg (A, B, and C). Then, make an API request to /api/dcim/power-outlet-templates/?devicetype_id=<pk>&feed_leg=A&feed_leg=B.

Expected Behavior

The first and second PowerOutletTemplates should be returned.

Observed Behavior

Only the second PowerOutletTemplate (assigned to feed_leg B) is returned. This is because the last value for feed_leg in the query parameters is applied to the filter.

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions