django get the fields of a related object not just pk code example Example: django filter on related field len(Collection.objects.filter(item__flag=True).distinct())