I have a model contact with a column called FullName which contains, for example, "John Smith".
How can order the data by the last name that appears in the FullName column?
For a long name like "John Smith Doe", I would like to order the data by the word "Doe". I am using postgres db
class Model(models.Model): @property def last_name(self): return full_name.split()[-1] ans = sorted(Model.objects.all(), key=lambda ans: ans.last_name)