Thanks Malcolm, I turned the queryset into a list, and it worked:
sidebar["countries"] = [country for country in
Country.objects.exclude(id=1).order_by('name')]

Now, just out of curiosity, why didn't I get an error before using
queryset refactor. I can't be sure that the caching actually happened,
but there was no exception raised.

Cheers,

Julien

On Apr 27, 10:37 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Sun, 2008-04-27 at 22:27 +1000, Malcolm Tredinnick wrote:
>
> [...]
>
> > Querysets aren't picklable. It's really hard! I'll work on it at some
> > point, but... it's really hard!
>
> To be more specific: I know what has to be done and have something
> half-implemented. It's fairly deep internals stuff, though, so it
> requires a bit more thinking and testing and is a little lower priority
> than some other missing features.
>
> Caching a list version of the queryset is almost certainly more
> efficient (it requires you to turn the queryset into a list, which is a
> small hassle): if we pickle a queryset, we're going to have to load all
> the results from the database, so now you're pickling the results plus
> all the queryset + query overhead. If you cache the list, you get rid of
> that second chunk.
>
> Regards,
> Malcolm
>
> --
> Many are called, few volunteer.http://www.pointy-stick.com/blog/
--~--~---------~--~----~------------~-------~--~----~
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