Clean way to use postgresql window functions in django ORM? : <p>I'd like to use postgresql window functions like <code>rank()</code> and <code>dense_rank</code> in some queries in need to do in Django. I have it working in raw SQL but I'm not sure how to do this in the ORM.</p>

<p>Simplified it looks like this:</p>

<pre><code>SELECT
    id,
    user_id,
    score,
    RANK() OVER(ORDER BY score DESC) AS rank
FROM
    game_score
WHERE
    ...
</code></pre>

<p>How would you do this in the ORM? </p>

<p>At some point I might need to add partitioning too :|</p>

<p>(we're using Django 1.9 on Python 3 and already depend on django.contrib.postgres features)</p>
