I have an array of values which I can use the
<t t-foreach="docs" t-as="doc">
Here is a summary of the code and its printout.
(THIS IS NOT REAL CODE JUST FOR DEMONSTRATION OF CONCEPT)
<t t-esc="doc.field"/> <br/>
<t t-foreach="doc.field" t-as="item">
<t t-esc="item"/> <br/>
<br/> <br/> <br/>
THIS CODE OUTPUTS THIS
model.field(1, 2, 3, 4, 5, 6)
As you can see the years are not in the correct order. What I would like to do would be.
<t t-set="newList" t-value="sorted(doc.field, key=lambda k: k['year'])"/>
<t t-foreach="newList" t-as="newItem">
However I get an error. I think the object none type or something like that.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 9/10/15, 7:52 AM|
|Seen: 2207 times|
|Last updated: 9/11/15, 4:17 PM|