Yes, sorry, I know the values are correct.

What's concerning me is that the {% cycle ... as ... %} statement is
*outputting* the value each time through the cycle instead of just
*setting* the {{ mycycle }} variable so that it can be output as
needed.


On Jul 7, 12:00 pm, thusjanthan <thusjant...@gmail.com> wrote:
> This is the desired behavior. Until the loop is done it cycles the
> given values you provided in your case 'a' 'b' and since the loop is
> running 3 times it cycles back to 'a' again.
>
> Cheers,
> Thusjanthan
>
> On Jul 7, 8:55 am, ringemup <ringe...@gmail.com> wrote:
>
> > Er, that was sloppy of me.  Actual output:
>
> > <ul>
> >   a
> >   <li>a</li>
> >   b
> >   <li>b</li>
> >   a
> >   <li>a</li>
> > </ul>
>
> > On Jul 7, 11:53 am, ringemup <ringe...@gmail.com> wrote:
>
> > > I thought that {% cycle 'a' 'b' as mycycle %} was supposed to just set
> > > the variable {{ mycycle }} and not output anything to the template.
>
> > > However, the following template (with myrange=[1, 2, 3]):
>
> > > {* start template *}
> > > <ul>
> > >   {% for i in myrange %}
> > >     {% cycle 'a' 'b' as mycycle %}
> > >     <li>{{ mycycle }}</li>
> > >   {% endfor %}
> > > </ul>
> > > {* end template *}
>
> > > outputs:
>
> > > <ul>
> > >   1
> > >   <li>1</li>
> > >   2
> > >   <li>2</li>
> > >   3
> > >   <li>3</li>
> > > </ul>
>
> > > Is this a bug or the desired behavior?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to