1👍
request.path
does not include the ‘?…’ querystring part of the URL, so this is working as designed – the path portion of the URL /articles/?page=2
is /articles/
.
Django compiles the querystring into the dictionary request.GET
, so one way of doing what you want is to check whether that dictionary is empty or not:
{% if not request.GET %}
request is for the plain URL /articles/
{% else %}
request has a querystring parameter on it
{% endif %}
Source:stackexchange.com