Foreign key annotation returns foreign keys. How can I get objects from a request? In the following example, the_user is a foreign key in the Voting model:
Vote.objects.values('the_user').annotate(vote_count=Count('the_user')).order_by('-vote_count')
He will return
[{'the_user': 4, 'vote_count': 12} , {'the_user': 6, 'vote_count': 2}]
But I need custom objects themselves. Non identifiers
source share