Friday, September 2, 2011

Re: Pickling a QuerySet

On Fri, Sep 2, 2011 at 11:05 AM, Kevin <kveroneau@gmail.com> wrote:
> An interesting question here, not sure if anybody has tried to pickle
> their QuerySets before.
>

Not only have people tried this before, but there is an entry in the
manual about it:

https://docs.djangoproject.com/en/1.3/ref/models/querysets/#pickling-querysets

wrt to your later question - how can you tell if the object already
exists in the database - you need to understand what django does when
you save a model, and how to customize that behaviour.

https://docs.djangoproject.com/en/1.3/ref/models/instances/#what-happens-when-you-save
https://docs.djangoproject.com/en/1.3/ref/models/instances/#how-django-knows-to-update-vs-insert
https://docs.djangoproject.com/en/1.3/ref/models/instances/#forcing-an-insert-or-update

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-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment