#24747: Allow transforms in order_by
----------------------------------------------+--------------------
Reporter: sparkyb | Owner: nobody
Type: New feature | Status: new
Component: Database layer (models, ORM) | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------------------+--------------------
The extension of lookups to support transforms is great, but I'd like to
be able to order by a transformed field.
As a use case, let's say I define a length transform. I filter by length
such as {{{Song.objects.filter(title__length__gt=10)}}}, but I think it
makes sense that I ought to also be able to sort by this transform, for
instance: {{{Song.objects.all().order_by('title__length')}}}
The related ticket #24629 points out that Func expressions should be
usable as transforms. Although in 1.8 I could get the desired sort by
ordering by the Length func expression, I feel that the reverse should
also be true, that I should be able to order by a transform.
--
Ticket URL: <https://code.djangoproject.com/ticket/24747>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.8cc43021bff6d870a6185251b67536e6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.