Code

#18952 closed Cleanup/optimization (wontfix)

template syntax to access individual elements of a list

Reported by: mail@… Owned by: nobody
Component: Documentation Version: 1.4
Severity: Normal Keywords: template syntax
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Maybe this is too trivial but I think that in addition to "first" and
"last" it could be mentioned at
https://docs.djangoproject.com/en/1.4/ref/templates/builtins/
that {{ value.0 }}, {{ value.1 }}, {{
value.2 }}, etc. can be used to access individual elements of a list.

Attachments (0)

Change History (1)

comment:1 Changed 22 months ago by timo

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

Thanks for the suggestion, but I don't think this is the best place for that bit of info since .0, .1 aren't filters. List lookup is described here: https://docs.djangoproject.com/en/dev/topics/templates/

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.