Django template, if tag based on current URL value

后端 未结 2 1015
清歌不尽
清歌不尽 2020-12-05 23:23

I want to be able to do an if tag based on the current URL value.

for example, if the current page\'s url is accounts/login/ then don\'t show a link, wi

2条回答
  •  甜味超标
    2020-12-06 00:06

    If you pass the "request" object to your template, then you are able to use this:

    {% if request.get_full_path == "/account/login/" %}
    

提交回复
热议问题