Is it possible to forcefully evaluate the request while maintaining the request

I would like to first evaluate a set of queries, that is, get objects in local memory, and then continue to execute various commands filteron selected objects.

Of course I could:

  • Drop the list of concepts and other native python syntax, but in many cases the django ORM syntax is more readable.
  • Skip evaluating the basic set of queries, but then I will get a performance hit, as I will need a few operations filterlater.

So. Is it possible to force an evaluation of a query by storing the result as a query object?

+4
source share
2 answers

How to do only len(myqueryset).

.

+3

: , , .

for item in myqueryset:
    pass

, , , . , filter() .

, , , , : .

+1

All Articles