#13119: Can't pickle queryset ---------------------------------------------------+------------------------ Reporter: anentropic | Owner: nobody Status: reopened | Milestone: Component: Database layer (models, ORM) | Version: 1.2-beta Resolution: | Keywords: querySet pickle Stage: Unreviewed | Has_patch: 0 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | ---------------------------------------------------+------------------------ Comment (by ashchristopher):
Fail. *sigh* This isn't really a solution to the problem, or if it is a solution to the problem then the documentation on Query Sets is incomplete. Either way, I don't believe this is solved. {{{ the_region = TripRegion.objects.all()[0] guides = DestinationGuide.objects.active().filter(region=the_region) }}} This statement is valid, but will not work when pickled {{{ pickle.dumps(guides) TypeError::can't pickle function objects }}} In order to get it to work, you need to change it to: {{{ the_region = TripRegion.objects.all()[0] guides = DestinationGuide.objects.active().filter(region__pk=the_region.pk) }}} I specifically get this problem when trying to cache query set results. It seems weird that I would have to change the way I do a lookup depending on whether I needed to cache the results or not. -- Ticket URL: <http://code.djangoproject.com/ticket/13119#comment:7> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.