Mako templates inline if statement

Posted by ensnare on Stack Overflow See other posts from Stack Overflow or by ensnare
Published on 2010-05-15T21:41:16Z Indexed on 2010/05/15 21:44 UTC
Read the original article Hit count: 370

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about python

Related posts about mako