Re: How to iterate through an int within template ?

2007-09-17 Thread Russell Keith-Magee

On 9/18/07, vincent garonne <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> Does someone knows how to do a loop on a int inside template, e.g. :

Well - looping in Django templates is quite similar to looping in
Python, so you can't 'loop on an int'. You can loop on a range, though
- so if you make pages = range(0,max_page), you will be able to use
the template you describe.

There was some talk over the sprint weekend about adding a 'repeat'
tag, or some equivalent syntax for 'iterate n times'; however, I'm not
sure how far that discussion went.

Yours,
Russ Magee %-)

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



How to iterate through an int within template ?

2007-09-17 Thread vincent garonne

Hello,

Does someone knows how to do a loop on a int inside template, e.g. :

Result Page: :
{% for p in pages %}
{% ifequal p page %}   
 {{p}} 
{% else %}
 {{p}}  
{% endifequal %}
{% endfor %}


Where pages is an int. Do i have to use a special filter function ?

Cheers,
 Vincent.

-- 
---<[EMAIL PROTECTED]>
Vincent Garonne   http://cern.ch/vincent.garonne
CERN PH, CH-1211, Geneva 23, Switzerland
Tel. +41 22 76 71181Fax. +41 22 76 78350
--=- 


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