Reputation: 1303
So I have this in a Django template.
{% if request.get_full_path = "/blog/" %}
do something
{% endif %}
Which does exactly what I want when I go to http://somesite.com/blog/
What I want to do is also include all subdirectories.
So something like
{% if request.get_full_path = "/blog/*" %}
do something
{% endif %}
Unfortunately as far as I can tell Django doesn't do wildcards in templates. So how do I do this?
Upvotes: 0
Views: 223
Reputation: 5876
Try with this:
{% if request.get_full_path|slice:'0:6' == '/blog/' %}
Upvotes: 1