[Fixed]-Fetching objects in complex through relationship Django

1👍

✅

You need to use multiple double.underscore steps. Actual code depends on your exact model and field names.
Something like:
Milestones.objects.filter(task__owner__teammember__id=1)

0👍

I you want to get milestone data for a particular member , you can get it by defining the fields in value queryset as follows:

TeamMember.objects.filter(id=1).values
('task__milestone','owner__task__milestone',
'task__milestone__expected_date','task__milestone__name')

I did not test it , but surely it will get all the related information.

Leave a comment