On 6/06/2016 9:39 AM, Mike Dewhirst wrote:
On 6/06/2016 7:26 AM, Mark Cuevas wrote:
I'm using the following, which works, but doesn't break properly. Â I'd
like three across for each row. Â How can I accomplish that?

{% for director in directors %}
  <tr class="{% cycle 'odd' 'even' %}">
      <td>
          {{ director.full_name }}
</td>
  </tr>
{% endfor %}

But I forgot the "break properly"

            <table>
              <tr>
                {% for item in synonyms.synonym_qs %}
                  <td width="33%">{{ item.name }}</td>
                  {% if forloop.last %}
                    </tr>
                  {% endif %}
                  {% if forloop.counter|divisibleby:3 %}
                    </tr><tr>
                  {% endif %}
                {% endfor %}
            </table>

You can see I made a synonyms class and populated it with a queryset.


You need to pad out your list or queryset of directors so it comes to mod(3) = 0

Use &nbsp; for the one or two extras

Then you can have three <td width="33%"> cells per row.

Mike



--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to django-users+unsubscr...@googlegroups.com
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/14552fd8-57ca-402f-8bd8-02a634acddef%40googlegroups.com <https://groups.google.com/d/msgid/django-users/14552fd8-57ca-402f-8bd8-02a634acddef%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/589e672d-4713-9a04-de67-4249e06d84c8%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

Reply via email to