views:

112

answers:

1

I have a template variable, c.is_friend, that I would like to use to determine whether or not a class is applied. For example:

if c.is_friend is True
<a href="#" class="friend">link</a>

if c.is_friend is False
<a href="#">link</a>

Is there some way to do this inline, like:

<a href="#" ${if c.is_friend is True}class="friend"{/if}>link</a>

Or something like that?

+2  A: 

Python's normal inline if works:

<a href="#" ${'class="friend"' if c.is_friend else ''}>link</a>
THC4k