I am very new to Django and Python.  I have been working on a pet
project that has a table of rows.  My thought was to have a counter in
the template, and use modulus to write out the row start/stops out.
The code looks 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>

Unfortunately this does not work.  The problem is with the counter
variables.  I was under the impression the {%  %} tags were just
python code that was executed, but it seems that it is not.  Can
someone point out the errors of my ways and set me on the correct path?
--~--~---------~--~----~------------~-------~--~----~
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