Milton Waddams wrote:
> Can someone tell me why this doesn't work?
>
> {% ifequal forloop.counter0 1 %}
>
> there are enough loops and the output of {{forloop.counter0}} does
> print 1 at the appropriate place?
>
> By work I mean it is never equal, I've tried putting the 1 in quotes
> with no difference.

Two problems:

The "if" style tags add these variables to the context stack inside the
loop.  The variables are not present in the context at the time the
"if" tag is interpreted.

However, even if they were, variables are not automatically
interpolated inside tags.  Some tags like {% extends %} do allow
variables as arguments, but in these cases the tag has been explicitly
coded to interpolate variable arguments - you can't assume this
behaviour.

Kieran

Reply via email to