On Tue, Oct 19, 2010 at 4:16 PM, Daniel Roseman <dan...@roseman.org.uk> wrote:
> The solution here is to evaluate the queryset in your view first,
> before passing it to the template. You can do this by simply calling
> list() on it - eg instead of defining your context as {'actor_list':
> actor_list}, do {'actor_list': list(actor_list)}. Bear in mind though,
> if you're doing things like pagination, this will end up being less
> efficient, as it will evaluate the *whole* queryset rather than just
> the elements you need for the page you're on.

I'm 100% sure Daniel is aware of this, but it is good to explicitly
point it out: this will also require more memory, as instead of
iterating through the queryset and producing one object at a time, it
has to create and store a list of objects.

Cheers

Tom

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

Reply via email to