{{ some_list|slice:":2" }}
where some_list is
some_list=[1,2,3,4]
I will get [1, 2].
Is it possible, via templates, to remove brackets?
Thanks
L.
Yes. After "slice" you get back a Python list which is converted to
string to appear on a page. Here you get brakets from default
representation of a list in Python. You can convert a list to a string
with "join" specifying what will be between items:
{{ some_list|slice:":2"|join:", " }}