Reputation: 11932
Sorry if I am being a moron, but what happen with this if tag ?
view return:
return render_to_response('productos/por_estado.html', {'productos':productos},
context_instance=RequestContext(request))
#Im not returning 'estado' !
template:
{% if estado %}
{% block activos_active %}class="active"{% endblock %}
{% endif %}
template html result:
class="active"
:S
Upvotes: 0
Views: 181
Reputation: 52237
One way to set class="active"
could be just this
<div{% if estado %} class="active"{% endif %}>....</div>
Upvotes: 1
Reputation: 19029
Block tags cannot be set conditionally, arguably because they are part of template inheritance. I believe this was an explicit design decision by the Django developers. See this Django ticket as well as this other question on Stack Overflow.
Upvotes: 4