request.path in django template

前端 未结 4 603
栀梦
栀梦 2020-12-19 13:42

I try something like this:

{% if request.path == \'contact\' %}
    

You are in Contact

{% endif %} {% if request.path == \'shop\' %}
4条回答
  •  悲&欢浪女
    2020-12-19 14:02

    Try:

    {% if request.path == '/contact/' %}
        

    You are in Contact

    {% elif request.path == '/shop/' %}

    You are in Shop

    {% endif %}

提交回复
热议问题