I get Invalid block tag: 'static', expected 'endif'
when I render the following template
{% load staticfiles %} <!-- in base.html -->/
<!-- ... -->
{% block content %}
{% if ava_url %}
<div><img src="{{ava_url}}"></div>
{% else %}
<div><img src="{% static 'img/default_ava.png' %}"></div>
{% endif %}
{% endblock %}
Why cannot I nest static
under if
?
Using Django 1.6.7
upd This is all in block container. Might be the reason. However when I remove if
{% load staticfiles %} <!-- in base.html -->
<!-- ... -->
{% block content %}
<div><img src="{% static 'img/default_ava.png' %}"></div>
{% endblock %}
I get Invalid block tag: 'static', expected 'endblock'
upd solved. included {% load staticfiles%}
in derived template. Sorry, it was not obvious, that {% load staticfiles%}
was in base template in the first place. The answer was found here
However I need further explanation: why {% load staticfiles%}
does not work from base template?