Template Filter - first
ExampleGet your own Django Server
Return the first item in a list:
<h1>{{ fruits|first }}</h1>
Run Example »
Definition and Usage
The first
filter returns the first item of
an object.
For strings, the first
filter returns the
first character:
Use the last
filter to return the last item.
Syntax
Template filters are defined by using a pipe |
character followed by the name of the filter.
{{ value|first }}