Object Count Widget filters ignore lists #8236

Closed
opened 2025-12-29 20:34:10 +01:00 by adam · 0 comments
Owner

Originally created by @dreng on GitHub (Jun 23, 2023).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.5.4

Python version

3.9

Steps to Reproduce

  1. Create a new widget
  • Widget type "Object Counts"
  • Models: DCIM > Device
  • Object filters: { "manufacturer_id": ["1", "2"] }
    (replace "1" and "2" with valid IDs in your environment)
  1. Check number of counted objects

Expected Behavior

I'd expect NetBox to take lists into account like shown above and just like the corresponding URL does: https://netbox.tld/dcim/devices/?manufacturer_id=1&manufacturer_id=2

As per https://github.com/netbox-community/netbox/issues/12742, Object Count filters employ standard UI filters rather than low-level queryset filters since v3.5.3. While this is a good design decision, queryset filters gave the ability to use logical OR filters. Since Object List filters take lists into account, I'd expect Object Count filters to do the same.

Observed Behavior

The number of counted objects is always equal to the number of all devices. Nothing will be filtered. The filter works if you use a single string and not a list, e.g. { "manufacturer_id": "1" }

This behaviour is not the case with Object Lists.

Originally created by @dreng on GitHub (Jun 23, 2023). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.5.4 ### Python version 3.9 ### Steps to Reproduce 1. Create a new widget - Widget type "Object Counts" - Models: DCIM > Device - Object filters: { "manufacturer_id": ["1", "2"] } (replace "1" and "2" with valid IDs in your environment) 2. Check number of counted objects ### Expected Behavior I'd expect NetBox to take lists into account like shown above and just like the corresponding URL does: https://netbox.tld/dcim/devices/?manufacturer_id=1&manufacturer_id=2 As per https://github.com/netbox-community/netbox/issues/12742, Object Count filters employ standard UI filters rather than low-level queryset filters since v3.5.3. While this is a good design decision, queryset filters gave the ability to use logical OR filters. Since Object List filters take lists into account, I'd expect Object Count filters to do the same. ### Observed Behavior The number of counted objects is always equal to the number of all devices. Nothing will be filtered. The filter works if you use a single string and not a list, e.g. { "manufacturer_id": "1" } This behaviour is not the case with Object Lists.
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 20:34:10 +01:00
adam closed this issue 2025-12-29 20:34:10 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8236