Django ORM group by one column and return other
<p>In simple worlds I try to write in Django a query which will return results</p>

<p>Similar to this:</p>

<pre><code>select id, max(score), screen, details from results
group by screen
where user_id=123
order by score desc, screen
</code></pre>

<p>My code:</p>

<pre><code>results = Results.objects.filter(user=user).values('screen').annotate(score=Max('score')).order_by('-score', 'screen')
</code></pre>

<p>But i doesn't return Results objects but json. I would like to get results as Results object like </p>

<pre><code>user = User.objects.filter(id=id)
results = Results.objects.filter(user=user).order_by('-score', 'screen')
</code></pre>

<p>Anyone can help?</p>