There is a list of objects:
[<imagemanager.util.DirImageItem object at 0xaa1bf8c>, <imagemanager.util.DirImageItem object at 0xa8f984c>, ...] If you look at the insides of one of the objects items[0].__dict__ , then this is what we will see:
{ 'fields': { 'attribs': 'RW', 'modifed': '2007-05-15 11:54', 'name': 'kl9e2itd07xcayohm5rq.png', 'created': '2010-02-22 13:36', 'url': '/media/news/kl9e2itd07xcayohm5rq.png', 'custom': {'width': 100, 'editable': False, 'thumbnail': True, 'height': 100}, 'path': '/media/news/kl9e2itd07xcayohm5rq.png', 'type': 'png', 'size': 435 }, 'filename': <dUrl /media/news/kl9e2itd07xcayohm5rq.png>} This contains each object, they need to be sorted by date created . Sort by new to old.
Tried like this:
items = sorted(items, key=lambda k: k.fields['modifed']) Alas, nothing has changed.
Tell me what I'm doing wrong, or another way to sort the objects.