About Case Sensitivity in PostgreSQL

PostgreSQL is case-sensitive. When ordering items alphabetically, at first you will see all items starting with capital letters, and then all items starting with small letters. To ignore the case when ordering model instances, you can use the Lower() function.

1
2
3
from django.db.models.functions import Lower

qs = Item.objects.order_by(Lower('title'))

Tips and Tricks Programming Databases Django 4.2 Django 3.2 Django 2.2 PostgreSQL