Reputation: 16194
Similar to this question:
Django template, if tag based on current URL value
only I want to check if the url has a word in it - you know, like
if a.find(b) == -1
how can i do this?
Upvotes: 15
Views: 17644
Reputation:
Forget request
parameters and use:
{% if 'search_term' in request.GET %}
Hello World!
{% endif %}
Upvotes: 2
Reputation: 10676
{% if b in request.path %}
hello world!
{% endif %}
If that doesn't accomplish what you need then move the logic to your view or create a custom template tag.
Upvotes: 34