Distinct queries and order_by

19 views
Skip to first unread message

David

unread,
May 10, 2012, 12:06:56 PM5/10/12
to django...@googlegroups.com
Hello

With a distinct query I understand the need to make the column that is required to be distinct the first column to order by.

eg:

    lm = Modification.objects.select_related().distinct('object_id').filter(
        content_type=topic_ct
        ).exclude(action=2).order_by('object_id', '-modified_on')

Having done the above, I need to reorder the resultset by modified_on and remove the object_id order. Is this possible? Do I need to take a copy of the queryset and order that?

Thank you for any assistance
Reply all
Reply to author
Forward
0 new messages