#24218: Use sub-query in ORM when distinct and order_by columns do not match -------------------------------------+------------------------------------- Reporter: Miroslav | Owner: nobody Shubernetskiy | Type: New feature | Status: new Component: Database layer | Version: master (models, ORM) | Severity: Normal | Resolution: Keywords: subquery distinct | Triage Stage: Accepted order_by | Has patch: 1 | Needs documentation: 1 Needs tests: 1 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by Harro):
* cc: Harro (added) Comment: This is exactly what I need right now. My proposal would be to add the distinct ordering to the distinct itself as a kwarg. {{{#!python Model.objects.all().distinct('foo', order_by=('-baz',)).order_by('bar') }}} -- Ticket URL: <https://code.djangoproject.com/ticket/24218#comment:10> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.833bfd06fed1111b92f5a9959d66a299%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.