Reputation: 2641
I'm working on a project and I'm trying to control navbar logo color change, after you visit about
page on my app, navbar should change color and half off it needs to be yellow so it will reflect on the purple background properly.
This project is build in django and I'm including my navbar
inside my base
template using standard template tag {% include 'navbar.html' %}
, and I'm {extends 'base.html' %}
to about
page, standard django
template inheritance,
but I'm failing to understand how can I control my navbar
logo, so is there a way that I can control this, and how, can I restrict my navbar
to just one template?
Upvotes: 1
Views: 38
Reputation: 4267
The easiest way to do this is by including logo into separate block and then overriding where you need.
base.html
:
{% block navbar %}
...
<div class='logo'></div>
...
{% endblock navbar %}
about.html
:
{% block navbar %}
...
<div class='logo red'></div>
...
{% endblock navbar %}
Upvotes: 1