Categories
How to slice an array in a django template?
There is an array arr passed to the template. How to slice arr[:5] in template ?
Answer the question
In order to leave comments, you need to log in
Here, try this https://djbook.ru/rel1.9/ref/templates/builtins.ht...
{{ some_list|slice:":2" }} Если some_list равно ['a', 'b', 'c'], вернет ['a', 'b'].
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question