On 1/18/07, David Zhou <[EMAIL PROTECTED]> wrote:
So Django would combine [1:3] and [3:10] into one database hit?

No.

a = MyModel.objects.all()
b = a[1:3] # This is a new QuerySet object with no knowledge of any others.
c = a[3:10] # This is another new QuerySet object with no knowledge of
any others.

Accessing an object in 'b' after doing this will result in a database
query. Accessing an object in 'c' after doing this will result in
*another* database query. This is because 'b' and 'c' are two
completely separate QuerySet objects, and have no way of knowing that
they could "collaborate" to combine their queries into one.



--
"May the forces of evil become confused on the way to your house."
 -- George Carlin

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to