How can I sort a dict like
my_dict = {
'abc': {'name': 'B', 'is_sth': True},
'xyz': {'name': 'A', 'is_sth': True}
}
by name
in Jinja?
I've tried {% for id, data in my_dict|dictsort(by='value') if data.is_sth %}
but doesn't work as I expect.
Solution:
my_dict.items()|sort(attribute='1.name')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With