I am new to Django and am trying to figure out how to use dynamic CSS that is only active for the current category a user is on.
I have a side nav with some categories and whichever category the user is on should be active with the use of a class.
This is currently how I have things:
{% for category in categories %}
<li><a href="{% url 'category' category.id %}"
{% if category.id in request.path %}
class="uk-text-bold"
{% endif %} >{{ category.name }}</a></li>
{% endif %}
This is obviously not correct and doesn't work so I imagine there is a proper way to do something like this and I'm just having a hard time understanding or finding that out.
Any help is appreciated! Thanks.