Opened 17 years ago

Closed 17 years ago

#4263 closed (invalid)

Insert select item from a collection into templates

Reported by: alessandro.ronchi@… 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.

Change History (3)

comment:1 by Ramiro Morales, 17 years ago

Doesn't {% items.5 %}, {% items.2 %} do what what you need?. See http://www.djangoproject.com/documentation/templates/#variables

comment:2 by anonymous, 17 years ago

Yes, you are right. I didn't knew of that.

comment:3 by Ramiro Morales, 17 years ago

Resolution: invalid
Status: newclosed

Then I'm closing the ticket.

Note: See TracTickets for help on using tickets.
Back to Top