Reputation: 115
I have a list of Django objects, all from the same class and those objects are not saved in the DB. I want to sort the list (again, a list of models) by a specific field in that class. How can I do that?
Thanks!
Upvotes: 1
Views: 2006
Reputation: 115
so this is what I did and it worked for me:
list_of_models = sorted(list_of_models , key = lambda x: x.object.time)
Upvotes: 4