-
assigned issue to
Add the name of the view in the context
Issue #100
closed
Why not add the name of the current view (often "self.view_name") in "self.get_context_data(**kwargs)" ?
Currently, one cannot highlight the active tab in "postman/base.html" ( "{% block postman_menu %}"). Adding this name could fix this problem.
Thanks for your attention.
Matthieu
Comments (3)
-
repo owner -
repo owner - changed status to open
I think you should avoid making a decision in a template, based on the name of the view.
For the case you mention, I prefer the following pattern extract (built on Bootstrap4):
In base.html:
<li class="nav-item {% block nav-sent %}{% endblock %}"> <a class="nav-link" href="{% url 'postman:sent' %}"> » {% trans "Sent Messages" %} </a> </li>
And in sent.html only:
... {% block nav-sent %}active{% endblock %} ...
-
repo owner - changed status to closed
No activity.
- Log in to comment