On Sat, Sep 12, 2009 at 4: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
add method to your model like should_be_bold which return boolean and
use it in template like
{% if row.should_be_bold %}class="bold"{%endif %}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---