I have a model:
class MyModel(models.Model):
name = models.TextField()
age = models.IntegerField(max_length=3)
I have names like: abraham lincoln
, john kennedy
, someone else
, doniyor
and many other
I want to sort them by name with this logic:
- show all people with name
john kennedy
first.
the other people should be shown after them.
I am a bit stuck because order_by()
takes fieldname and not values as parameter. How do I do this in django?