human
Django - How to sort queryset by number of character in a field
assistant
Here is some code to sort query set by number of characters in a field `length` in django model `MyModel`

MyModel.objects.extra(select={'length': 'Length(name)'}).order_by('length')

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.