On 11/2/06, Rachel Willmer <[EMAIL PROTECTED]> wrote:
>
> I'm sure this must be a FAQ but I can't see the answer anywhere...
>
> I'd like to buld a table from a for loop. One field in each line will
> depend on the previous line, so I'd like to do something like this:
>
> {% for line in lines %}
> {% if notequal line.name prevname %}
> {{ line.name }}
> {% endif %}
> set prevname=line.name
> {% endfor %}
>


Will the 'ifchanged' tag do it for you?
http://www.djangoproject.com/documentation/templates/#ifchanged

I haven't used it myself, but I think it'd be something like:

{% for line in lines %}
{% ifchanged %} line.name {% endifchanged %}
{% endfor %}

Jay P.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to