Re: Is there a way to limit the number of element in the template

2008-01-06 Thread Alex Koshelev
I'm realy glad:) On 7 янв, 03:15, "Alexandre Forget" <[EMAIL PROTECTED]> wrote: > you are right ! it works now, thanks > > django fresh from svn > > On Jan 6, 2008 7:10 PM, Alex Koshelev <[EMAIL PROTECTED]> wrote: > > > > > Note you must delete *all* spaces in filter expression > > >

Re: Is there a way to limit the number of element in the template

2008-01-06 Thread Alexandre Forget
you are right ! it works now, thanks django fresh from svn On Jan 6, 2008 7:10 PM, Alex Koshelev <[EMAIL PROTECTED]> wrote: > > Note you must delete *all* spaces in filter expression > > part.forum.thread_set.all|slice:":5" > > And what is your django version? > > On 7 янв, 02:55, "Alexandre

Re: Is there a way to limit the number of element in the template

2008-01-06 Thread Alex Koshelev
Note you must delete *all* spaces in filter expression part.forum.thread_set.all|slice:":5" And what is your django version? On 7 янв, 02:55, "Alexandre Forget" <[EMAIL PROTECTED]> wrote: > I tried with and without... no difference > > On Jan 6, 2008 6:32 PM, Alex Koshelev <[EMAIL PROTECTED]>

Re: Is there a way to limit the number of element in the template

2008-01-06 Thread Alexandre Forget
I tried with and without... no difference On Jan 6, 2008 6:32 PM, Alex Koshelev <[EMAIL PROTECTED]> wrote: > > Have you put a space between "all" and filter mark? > > On 7 янв, 02:27, "Alexandre Forget" <[EMAIL PROTECTED]> wrote: > > update: it doesn't work in the for loop. > > > >

Re: Is there a way to limit the number of element in the template

2008-01-06 Thread Alex Koshelev
Have you put a space between "all" and filter mark? On 7 янв, 02:27, "Alexandre Forget" <[EMAIL PROTECTED]> wrote: > update: it doesn't work in the for loop. > > -- > TemplateSyntaxError at /parts/8051/ > > 'for' statements should use the format 'for x in y': for t in >

Re: Is there a way to limit the number of element in the template

2008-01-06 Thread Alexandre Forget
update: it doesn't work in the for loop. -- TemplateSyntaxError at /parts/8051/ 'for' statements should use the format 'for x in y': for t in part.forum.thread_set.all |slice: ":5" -- this is the offending line: {% for t in part.forum.thread_set.all |slice: ":5" %}

Re: Is there a way to limit the number of element in the template

2008-01-06 Thread Alexandre Forget
On Jan 6, 2008 5:44 PM, Alex Koshelev <[EMAIL PROTECTED]> wrote: > > First of all, Part.objects.all()[:5] is still lazy. SQL query executes > only when you try to iterate through items. > And you can slice objects in template with "slice" filter > > {% for p in part.object.all|slice:":5" %} >

Re: Is there a way to limit the number of element in the template

2008-01-06 Thread Alex Koshelev
First of all, Part.objects.all()[:5] is still lazy. SQL query executes only when you try to iterate through items. And you can slice objects in template with "slice" filter {% for p in part.object.all|slice:":5" %} On 7 янв, 01:13, "Alexandre Forget" <[EMAIL PROTECTED]> wrote: > Hi, > > I need

Is there a way to limit the number of element in the template

2008-01-06 Thread Alexandre Forget
Hi, I need to limit the number of elements I have to display on an index page. Right now I do something like this in the template. {% for p in part.object.all %} ... {% endfor %} Witch obliviously output all objects in the set. In the view, I can do it this way: Part.objects.all()[:5] I