Add order_by with sql LOWER() support
|Reported by:||Raydiation||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.1|
|Cc:||gav, hv@…||Triage Stage:||Accepted|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I have to order a huge list of of names and when i order by the the title of an artist, uppercase A comes after lowercase z, which i dont want. To fix it i currently order with the extra() method which is very inconveniant. I thought of something like:
result = MusicCollection.objects.all().order_by(artists__lower, songs__lower)
triggers the sql LOWER() function on the column.
This would take less effort than to use the long extra statement every time.
Change History (10)
comment:1 Changed 4 years ago by russellm
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted