Hi, Before I put any work into this, I want to know if (a) I'm missing something super-obvious in the QuerySet functionality, or (b) this idea has already been explored and rejected.
Sometimes, it would be nice to get a slice of a QuerySet but *not* actually evaluate the QuerySet; instead, leave it unevaluated. An example of this would be an implementation of blog navigation: context['previous_entry'] = Entry.objects.filter(entry_date__lt=current.entry_date).order_by('-entry_date')[0] context['next_entry'] = Entry.objects.filter(entry_date__gt=current.entry_date).order_by('entry_date')[0] This works fine, but it grabs the relevant object immediately. It would be handy to have a syntax that continued to defer the execution of the query, in case (for example) the navigation is cached by a template fragment {% cache $} tag. Something like: context['previous_entry'] = Entry.objects.filter(entry_date__lt=current.entry_date).order_by('-entry_date').limit(limit=1, offset=0) context['next_entry'] = Entry.objects.filter(entry_date__gt=current.entry_date).order_by('entry_date').limit(limit=1, offset=0) Then, in the template, {{ previous_entry.get }} could be used to fetch the result. Thoughts? -- -- Christophe Pettus x...@thebuild.com -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.