Slicing a list in a Django template


Django tip:

You can return only part of the list in a Django template by using the slice filter.

The syntax for slicing is the same as for Python’s list slicing.

{{ friends|slice:":3" }}