Using cycle to Django? -


i developing django application, had problem,

i hope following effects on django,

<div id='cssmenu'> <ul> <li class='active'><a href='#'><span>home</span></a></li>    <li><a href='#'><span>products</span></a></li>    <li><a href='#'><span>company</span></a></li>    <li class='last'><a href='#'><span>contact</span></a></li> </ul> </div> 

django code,

<div id='cssmenu'> {% child in children %} {% cycle 'active' 'last' cssmenu silent %} <li class="{{ cssmenu }}">     <a href="{{ child.attr.redirect_url|default:child.get_absolute_url }}">{{ child.get_menu_title }}</a>     {% if child.children %}     <ul>         {% show_menu from_level to_level extra_inactive extra_active template "" "" child %}     </ul>     {% endif %} </li> {% endfor %} </div> 

could me?

that's not cycle for: it's alternating between 2 or more alternatives. don't want @ all.

instead, use forloop attributes:

{% child in children %}     <li class="{% if forloop.first %}active{% elif forloop.last %}last{% endif %}">...</li> {% endfor %} 

although suppose don't want first 1 active, haven't given information how want determine 'active' goes.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -