Opened 18 years ago
Closed 18 years ago
#4263 closed (invalid)
Insert select item from a collection into templates
Reported by: | Owned by: | Jacob | |
---|---|---|---|
Component: | Uncategorized | Version: | dev |
Severity: | Keywords: | templates selection for | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If I have a set of items I can only cycle them with {% for item in items.all %}.
But it don't permits to take the item n° 5 and put it into a place, the n° 2 and put in another, and so on.
It's very useful with images related to objects: if you want to make images float in particular places, a single selection would be sufficient. Now I can only add to my model a getFirstImage method, but it's a presentation problem and it's not correct to put it in models or views.
Note:
See TracTickets
for help on using tickets.
Doesn't
{% items.5 %
},{% items.2 %
} do what what you need?. See http://www.djangoproject.com/documentation/templates/#variables