On Jan 18, 2007, at 4:21 PM, James Bennett wrote:


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

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.

What is the recommended method to slice querysets into multiple chunks? To do 1:10 and explicitly turn the set into a list, slicing that, and passing it into context? Would that still work in templates? I'm not too clear on how using them in a template works when accessing object values and such.

Or is it to just use multiple loops and conditionals in the template?

The latter seems really heavy for something simple.

---
David Zhou
[EMAIL PROTECTED]




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to [email protected]
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