[Python] Custom template conditon in Django [closed]

Discussão em 'Python' iniciado por Stack, Fevereiro 27, 2025.

  1. Stack

    Stack Membro Participativo

    In my Django project I want to hide menu option under a custom built condition. In my base.html I want a construction like this:

    {% if my_condition %}
    <a class="dropdown-item" href="...">New article</a>
    {% endif %}


    How to write 'my_condition'? I searched for 'custom template condition', but they all the answers direct me to the 'custom template tags and filters' of the Django documentation, but I can't find a satisfying solution.

    Continue reading...

Compartilhe esta Página