Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object Count Widget filters ignore lists #12977

Closed
dreng opened this issue Jun 23, 2023 · 0 comments · Fixed by #12991
Closed

Object Count Widget filters ignore lists #12977

dreng opened this issue Jun 23, 2023 · 0 comments · Fixed by #12991
Assignees
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@dreng
Copy link
Contributor

dreng commented Jun 23, 2023

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 #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.

@dreng dreng added the type: bug A confirmed report of unexpected behavior in the application label Jun 23, 2023
@jeremystretch jeremystretch added status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation severity: low Does not significantly disrupt application functionality, or a workaround is available labels Jun 23, 2023
@jeremystretch jeremystretch self-assigned this Jun 23, 2023
@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation labels Jun 23, 2023
jeremystretch added a commit that referenced this issue Jun 26, 2023
…12991)

* Fixes #12977: Introduce dict_to_querydict() to ensure proper handling of QueryDicts

* Remove unused import
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants