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
rn the original queryset. Seems like I'll have to write raw
queries in such cases :(
On Feb 11, 1:18 pm, kurvenschubser wrote:
> Hi myx,
>
> cloning is useful for chaining of filters, e.g.
> User.objects.filter(name="Harry").exclude(lastname="Potter").filter(somethi
Almost every method of QuerySet clones it. Sometimes it is very
ineficcient, for example when querysets are constructed in loops. I
have a function, which makes about 20 queries, and its execution time
is about 100ms. After profiling the function, I saw that clone() takes
most of the time: 70ms. It
3 matches
Mail list logo