Devin B.
Devin B.

Reputation: 453

Changing Bootstrap nav-item active class (of dropdown) within Django

For some reason Django blocks aren't properly extending 'active' for me.

So this works in base.html:

<li class="nav-item dropdown active">

But this doesn't:

<li class="nav-item dropdown {% block 'index_active' %}{% endblock %}">

An example of my index or about html:

{% extends "client_side_app/base.html" %}

{% block index_active %}
    active
{% endblock %}

What's odd about this is that I have content blocks right below this above code that have no problem injecting the html into the base.html.

Any idea as to why this is happening? :(

Thanks,

Dev

PS - I came to this stack overflow thread first and tried implementing javascript and basically came to the same issue to the guy asking the question. I essentially tried both ways to no avail, and a lot of other things to boot.

Upvotes: 0

Views: 228

Answers (1)

mixxorz
mixxorz

Reputation: 461

The block names don't match. index_active is defined in base.html but about_active is used in the sub-template.

Upvotes: 2

Related Questions