Case insensitive queryset sorting in Django
django, django-queryset, python, sqlite
Solution
Not sure if you can do it with the ORM directly. But using the `extra()` clause, you can try doing this:
MyModel.objects.extra(select={'case_insensitive_title': 'lower(title)'}).order_by('case_insensitive_title')
Problem
Is it possible to sort Django queryset case insensitively? This query: ``` MyModel.objects.order_by('title') ``` uses case sensitive sorting. The result is sorted like this: ``` X.. a.. b.. ``` But I would like to sort titles like this: ``` a.. b.. X.. ```