Re: filtering a QuerySet after a slice

2013-09-30 Thread Michael Manfre
Array slicing doesn't always return a QuerySet and shouldn't be adapted to this proposed behavior. Directly exposing Query.set_limits() on the QuerySet would most likely have confusing behavior to at least some group of people. Given the current behavior of Query.set_limits(), what should be the s

Re: filtering a QuerySet after a slice

2013-09-30 Thread Rimvydas Naktinis
I completely agree with Gary's argumentation here. And I would love to see .limit() introduced (or array slicing adapted). I ran into a situation where I have access into intermediate queryset() construction, where I normally do add .filter() statements, but now I had to limit a number of queri

Re: filtering a QuerySet after a slice

2007-12-04 Thread Gary Wilson
Luke Plant wrote: > On Tuesday 04 December 2007 07:25:31 Gary Wilson wrote: > >> Sort of my point. Since filter() and [:] both return QuerySets why >> should they be any different: >> >> UTPerson.objects.all().filter(name__startswith='a')[:10] > > 1) This, logically, should return the first ten

Re: filtering a QuerySet after a slice

2007-12-04 Thread Luke Plant
On Tuesday 04 December 2007 07:25:31 Gary Wilson wrote: > Sort of my point. Since filter() and [:] both return QuerySets why > should they be any different: > > UTPerson.objects.all().filter(name__startswith='a')[:10] 1) This, logically, should return the first ten people whose 'name' starts w

Re: filtering a QuerySet after a slice

2007-12-03 Thread Gary Wilson
Derek Anderson wrote: > even if it was possible, i don't think it's what you would really want. > logically, this would return an indefinite number of records, > somewhere between 0 and 10, depending on what's in your table, not the > first 10 records of people who's name starts w/ an 'a'.

Re: filtering a QuerySet after a slice

2007-12-03 Thread Derek Anderson
even if it was possible, i don't think it's what you would really want. logically, this would return an indefinite number of records, somewhere between 0 and 10, depending on what's in your table, not the first 10 records of people who's name starts w/ an 'a'. why are you not doing this? U