Wednesday, October 5, 2011

Question about Template

I want to put pictures on website and to let each row shows only four
pictures, but I write the template which shows each pictures in the
same row.
the loop within the <tr>, I think it should include <tr> and add if
syntax to do that.
How to write the syntax?
thanks!

{% load static %}
{% get_static_prefix as STATIC_PREFIX %}

<table>
<tr>
{% for photo in photos %}
<td>
<img src="{{ STATIC_PREFIX }}{{photo.image}}" width="186"
height="186" alt="" />
<p>{{photo.title}}</p>
</td>
{% endfor %}
</tr>
</table>

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment