Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if this is the index page in Django?

Tags:

python

django

How can I check of the present page is the index page in a Django template?

{% if What Goes Here??? %}

// whatever

{% endif %}
like image 291
Tyler Avatar asked Dec 28 '22 19:12

Tyler


1 Answers

TEMPLATE_CONTEXT_PROCESSORS = (
    'django.core.context_processors.request',
    ...
)


{% if request.path == "/" %}
    ...
{% endif %}
like image 164
Timmy O'Mahony Avatar answered Jan 12 '23 19:01

Timmy O'Mahony