How do I sort a list of python Django objects?
Posted
by alex
on Stack Overflow
See other posts from Stack Overflow
or by alex
Published on 2010-05-26T20:33:22Z
Indexed on
2010/05/26
23:31 UTC
Read the original article
Hit count: 116
In Django, I have a model object in a list.
[object, object, object]
Each object has ".name" which is the title of the thing.
How do I sort alphabetically by this title?
This doesn't work:
catlist.sort(key=lambda x.name: x.name.lower())
© Stack Overflow or respective owner