Dashboard "object counts" widgets can't filter on multiple tenants #8054

Closed
opened 2025-12-29 20:31:45 +01:00 by adam · 2 comments
Owner

Originally created by @eric-eisenhart on GitHub (May 13, 2023).

NetBox version

v3.5.1

Python version

3.9

Steps to Reproduce

  1. Create or edit a widget of type "objects type list".
  2. Select Models of "DCIM > Cable", "DCIM > Device", "DCIM > Rack", and "DCIM > Site".
  3. Give it an object filter of {"tenant_id": ["19", "34"]}. (pick tenant ids that exist in this specific install)

Expected Behavior

Save widget and widget shows me counts for the total of things for both those tenants.

Similar syntax works to filter an object list "object change" list (changelog) by changed_object_type_id:
{"changed_object_type_id": ["14", "27", "30", "23", "51", "80", "87", "130", "78", "79", "8", "67", "70", "68", "69", "86"]}
image

Observed Behavior

Error: "Invalid filter specification for cables." and can't save.

image

(changing to any single one of the models does not make it work)

Originally created by @eric-eisenhart on GitHub (May 13, 2023). ### NetBox version v3.5.1 ### Python version 3.9 ### Steps to Reproduce 1. Create or edit a widget of type "objects type list". 2. Select Models of "DCIM > Cable", "DCIM > Device", "DCIM > Rack", and "DCIM > Site". 3. Give it an object filter of `{"tenant_id": ["19", "34"]}`. (pick tenant ids that exist in this specific install) ### Expected Behavior Save widget and widget shows me counts for the total of things for both those tenants. Similar syntax works to filter an object list "object change" list (changelog) by changed_object_type_id: `{"changed_object_type_id": ["14", "27", "30", "23", "51", "80", "87", "130", "78", "79", "8", "67", "70", "68", "69", "86"]}` ![image](https://github.com/netbox-community/netbox/assets/1577595/0a7e7ee9-f251-4599-a799-3c19f460399b) ### Observed Behavior Error: "Invalid filter specification for cables." and can't save. ![image](https://github.com/netbox-community/netbox/assets/1577595/e7955673-eebc-46cc-8cb9-50276f1ee945) (changing to any single one of the models does not make it work)
adam closed this issue 2025-12-29 20:31:45 +01:00
Author
Owner

@abhi1693 commented on GitHub (May 13, 2023):

You need to use tenant_id__in to filter using list.

@abhi1693 commented on GitHub (May 13, 2023): You need to use `tenant_id__in` to filter using list.
Author
Owner

@eric-eisenhart commented on GitHub (May 13, 2023):

I guess this is a duplicate of #12628

FYI: the main way I know to work out the json filter syntax is to go to something like /dcim/devices, filter the list, then "save" and copy the "Parameters". If I filter to those two tenants, I get:

{
    "tenant_id": [
        "19",
        "34"
    ]
}
@eric-eisenhart commented on GitHub (May 13, 2023): I guess this is a duplicate of #12628 FYI: the main way I know to work out the json filter syntax is to go to something like /dcim/devices, filter the list, then "save" and copy the "Parameters". If I filter to those two tenants, I get: ```json { "tenant_id": [ "19", "34" ] } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8054