开发者

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

开发者 https://www.devze.com 2023-03-12 00:06 出处:网络
How can I check of the present page is the index page in a Django templ开发者_如何转开发ate? {% if What Goes Here??? %}

How can I check of the present page is the index page in a Django templ开发者_如何转开发ate?

{% if What Goes Here??? %}

// whatever

{% endif %}


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


{% if request.path == "/" %}
    ...
{% endif %}


You can just add your template code to the index page template itself.

0

精彩评论

暂无评论...
验证码 换一张
取 消