On Sep 12, 3:12 pm, adelaide_mike <[email protected]> wrote:
> Django 1.0.2 In the following template I intend to make rows that
> have an empty second column bold. Hence trying 2 in row. My syntax
> is wrong due to inexperience with Python, and possibly my methodology
> also.
>
> {% extends "base.html" %}
> {% block content %}
>
> <body>
> <h1>Agent summary report</h1>
> <p> The most recent listing for each property listed within the past
> 12 weeks</p>
> <div class="container small">
>
> <table>
> <thead>
> <th class="span-7">Address</th>
> <th class="span-2">Date</th>
> <th class="span-4">Price</th>
> <th class="span-1">Method</th>
> <th class="span-2">Agent</th>
> <th class="span-3"> </th>
> <th class="span-3 last">Mobile</th>
> </thead>
> <tbody>
> {% for row in listings %}
> <tr {% ifequal 2 in row None %}class="bold-row"{%
> endifequal %}
>
> {% for item in row %}
> <td>{{ item }}</td>
> {% endfor %}
> </tr>
>
> {% endfor %}
> </tbody>
> </table>
> </div>
>
> </body>
>
> {% endblock %}
>
> Is there a way to do this?
>
> Mike
Your methodology seems to be "guess the syntax". Looking in the
documentation would be more fruitful. Or, do a search of this group,
as this question comes up regularly.
There are two ways of doing it - either use the {% cycle %} tag or use
{% if forloop.counter|divisible_by:2 %}
--
DR.
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---