Sorry for the late response.
Maybe it's sufficient to override the QuerySet clone method to just return
self, not really clone it.
2011/2/14 myx
> Thank you for the reply. But I meant a slightly different case:
>
> Item.objects.filter(...).order_by(...).values_list('id', flat=True)[:
> 10]
>
>
On 14 фев, 15:21, myx wrote:
> Thank you for the reply. But I meant a slightly different case:
>
> Item.objects.filter(...).order_by(...).values_list('id', flat=True)[:
> 10]
>
> As you can see, there are four cloning operations. Wouldn't be
> chaining possible without cloning the queryset? The me
On Thu, Feb 24, 2011 at 11:20 AM, myx wrote:
> I found a solution which is suitable for me.
> As it turns out, all those methods just clone queryset, and then call
> appropriate methods of Query object.
> So, for example, to set ordering and to get a slice without cloning
> queryset, I can do the
I found a solution which is suitable for me.
As it turns out, all those methods just clone queryset, and then call
appropriate methods of Query object.
So, for example, to set ordering and to get a slice without cloning
queryset, I can do the following:
qs.query.add_ordering('-created')
qs.query.s
Thank you for the reply. But I meant a slightly different case:
Item.objects.filter(...).order_by(...).values_list('id', flat=True)[:
10]
As you can see, there are four cloning operations. Wouldn't be
chaining possible without cloning the queryset? The method could just
return the original querys
Hi myx,
cloning is useful for chaining of filters, e.g.
User.objects.filter(name="Harry").exclude(lastname="Potter").filter(somethingelse="bla")
But most of the time, I found I can construct querysets using a
dictionary for collecting the query conditions:
d = {name:"Harry", lastname:"Potter", s
6 matches
Mail list logo