Setting the selected tab from the template

How to select the main template tabs status from a child template using Django:


{% 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>
{% endblock %}


{% extends "base.html" %}

{% block tabs%}
{% with "inactive" as SEARCH_TAB_STATUS %}
{% with "active" as REGISTER_TAB_STATUS %}
{{ block.super }}
{% endwith %}
{% endwith %}
{% endblock %}

Nice one!!!

  • Ophelia Blaski

    I appreciate, cause I found exactly what I was looking for. You have ended my four day long hunt! God Bless you man. Have a nice day. Bye