I don't think it is a good idea to serialize random django models. Passing the id is much safer.

http://docs.celeryproject.org/en/latest/userguide/tasks.html

"Another gotcha is Django model objects. They shouldn’t be passed on as arguments to tasks. It’s almost always better to re-fetch the object from the database when the task is running instead, as using old data may lead to race conditions."


On Oct 8, 2013, at 9:40 PM, Steve Lamb <notifications@github.com> wrote:

> In opentreemap/exporter/views.py:
> 
> > @@ -15,7 +15,7 @@ def begin_export(request, instance, model):
> >          job.user = request.user
> >      job.save()
> >  
> > -    async_csv_export.delay(job, model, query)
> > +    async_csv_export.delay(job.pk, model, query)
> is there a reason to send the pk and not the whole job?
> 
> —
> Reply to this email directly or view it on GitHub.
>