django and I do not know how to sort this list by title order.
I'm using:
nuevo_json_array = sorted(json_array, key=itemgetter('oportunidad_json'))
[
{
'pk': 1
'oportunidad_json':OrderedDict([
('id',38441),
('titulo', 'Barelona'), ]),
'fecha':'2018-10-30T02:00:00',
'clase':'A'
},
{
'pk': 2
'oportunidad_json':OrderedDict([
('id',1223),
('titulo', 'Alicante'), ]),
'fecha':'2018-10-30T02:00:00',
'clase':'B'
},
{
'pk': 3
'oportunidad_json':OrderedDict([
('id',577),
('titulo', 'Madrid'), ]),
'fecha':'2018-10-30T02:00:00',
'clase':'C'
}
]
but I get the following error:
unorderable types: collections.OrderedDict() < collections.OrderedDict()