Filtering on fields of related objects using double underscore syntax (?tenant__name=foo) #18865
-
Hi Guys, I had the below functionality in mind as being available in netbox 'in the past'. But since it's not in the filtering guide I have my doubts. Basically, should filtering by a field of a related object work? On the demo instance and my own it doesn't filter out any results. How do people implement a filter on to get all the Sites for a tenant, for which they don't (yet) have the tenantID?
Any insights will be appreciated |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
This has never been supported in NetBox. You may be thinking of the underlying Django ORM, which does support following model relations using a double underscore. |
Beta Was this translation helpful? Give feedback.
You would need to devise a rough technical implementation first. I invite you to explore the manner in which filters are currently generated. I don't believe django-filter provides any native capability to support this but I could be wrong.