Help with django filters
I am have a list of "Entries"
I want to get the first entry in the list's "title".
In the template I tried writing
{{ Entries|first.title }}
But it results in an erro开发者_StackOverflow中文版r.
Is there a way to achieve this without writing a loop or doing it in the view?
Assuming you passed a list of Entries to the template under the name 'Entries',
{{ Entries.0.title }}
will give you the title of the first entry in the list. The first
filter isn't the shortest path to where you want to go in this case.
精彩评论