How to select the main template tabs status from a child template using Django:
base.html:
{% block tabs%}
<ul class=”menu”>
<li class=”{{ SEARCH_TAB_STATUS }}”><a href=”/”>
<span>{% trans “search_professional” %}</span></a></li>
<li class=”{{ REGISTER_TAB_STATUS }}”><a href=”/register”>
<span>{% trans “want_work” %}</span></a></li>
</ul>
{% endblock %}
register.html:
{% extends “base.html” %}
{% block tabs%}
{% with “inactive” as SEARCH_TAB_STATUS %}
{% with “active” as REGISTER_TAB_STATUS %}
{{ block.super }}
{% endwith %}
{% endwith %}
{% endblock %}
Nice one!!!