Monday, September 29, 2014

Re: templates: if and static tags incompatible?

The problem is that static is not being recognized as a valid Django
tag.  Add this line to the top of the template file to define it.

{% load staticfiles %}

Fred Stluka -- --
Bristle Software, Inc -- -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.
On 9/29/14 12:41 PM, chansonsyiddish wrote:

I've got a small problem:

here is the code in my template:

{% if p.fleches %}
<A HREF=#haut><img alt='haut-up' src="{% static "images/fleche-haut.jpg" %}" ></A>
{% endif %}

and the django development server tells me:

Django Version: 1.4.5
Exception Type: TemplateSyntaxError
Exception Value:
Invalid block tag: 'static', expected 'elif', 'else' or 'endif'

Is it a bug, or is it really impossible to put a static tag inside an if tag?

Thanks in advance!

You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment