How to filter by fields of nested objects? #1424
-
Hello, I have a serializer with multiple fields which are themselves serializers:
It seems to work well enough to specify 'app_host' as a filterset field in my TenantViewSet, and I can get Tenants with an App Host of a target pk value:
However, how does one go about filtering Parent objects by their relationship to Child objects with a specific field value, for instance, if I wanted to say "Give me all Tenants who are on an App Host with load_balancer_fqdn = 'X'"? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I think this is what you are looking for: |
Beta Was this translation helpful? Give feedback.
I think this is what you are looking for:
db_host__load_balancer_fqdn
(https://docs.djangoproject.com/en/dev/topics/db/queries/#lookups-that-span-relationships)