[Fixed]-Django + postgres: orderby + distinct + filter() – strange behaviour

1👍

You are confused about the interaction between the distinct() call and the rest of the filter.

All distinct('claim_id) will do is ensure that one item per claim is returned. But you only ask for one item; when you add the filter for status=2, you still only get one item for the distinct value of claim_id. That it’s not the same one you get if you don’t add the filter is irrelevant.

Leave a comment