[Answered ]-How to sort by letter in Django

1👍

You can work with __range on the Lower [Django-doc] of the field:

from django.db.models.functions import Lower

letters = selected_range.split('-')
queryset = tabir.objects.alias(title_lower=Lower('title')).filter(
    title_lower__range=letters, is_active=True
)

Leave a comment