I have a pretty simple template that needs to print some data in a
bunch of table rows.  I have done something like this:

<table>
{% if my_art_list %}
        {% count = 0 %}
        {% for art in my_art_list %}
                {% if count%3 = 0 %}
                <tr>
                {% endif %}
                        <td>
                                <img src="{{ art.img_path }}" alt="{{ art.title 
}}" />
                        </td>
                {% if count%3 = 2 %}
                </tr>
                {% endif %}
        {% endfor %}
        </tr>
{% else %}
        <p>You have no art pieces to view.  Would you like to add some?</p>
{% endif %}
</table>

However, as you probably suspect, the "count" variables cause all
sorts of trouble.  Is there a way to have tracking variables in the
template code?  I was under the impression that the {%  %} tags were
just straight Python code and would execute as such, but apparently my
understanding is a little less than adequate.

Please help me sort this out...

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to