title: Passing User object in celery using django
body: <p>I'm currently editing the save method in one of my models, so that I can save who changed an object or created a new one.</p>
  
  <p>Currently, its working fine when its ran in the main thread, but the save method is also used in different tasks through Celery. And when the save method is ran in a task <code>get user</code> returns <code>None</code>. To get a user i'm currently using <a href="https://github.com/Alir3z4/django-cuser" rel="nofollow noreferrer">django-curser</a> since this model is being used in different apps inside my Django project. </p>
  
  <p>Is there a way to send the current user to celery? I've been told to use a context manager or a wrapper but im not sure how.</p>
  
  <p>My save method is:</p>
  
  <pre><code>    def save(self, *args, **kwargs):
          from models import Log
          log_entry = Log()
          log_entry.object_id = self.id
          log_entry.object_repr = self
          user = CuserMiddleware.get_user()
          log_entry.user = user
          log_entry.content_type_id = ContentType.objects.get_for_model(self).id
          log_entry.save()
  </code></pre>
  
  <p>Thanks.</p>