Add order_by with sql LOWER() support
|Reported by:||Raydiation||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.1|
|Severity:||Normal||Keywords:||sql, order, lower|
|Cc:||George Vilches, 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.