Django: get URL of current page, including parameters, in a template

前端 未结 6 1254
忘了有多久
忘了有多久 2020-12-01 00:05

Is there a way to get the current page URL and all its parameters in a Django template?

For example, a templatetag that would print a full URL like /foo/bar?p

6条回答
  •  情书的邮戳
    2020-12-01 00:43

    You can see if your url differs from the others.

    {% if 'foo/bar/' in request.get_full_path %}
    

提交回复
热议问题