title: Django: copy and update a queryset
body: <p>I have the following models:</p>
  
  <pre><code>class A(models.Model):
      pass
  
  class B(models.Model):
     a = models.ForeignKey(A, related_name="bs")
  </code></pre>
  
  <p>then I have a function where I create a new record of object <code>A</code> and I would like to copy all the related records of <code>B</code></p>
  
  <p>I have done something such as </p>
  
  <pre><code>def foo(new_a, old_a):
      old_a.bs.all().update(pk=None, a=new_a)
  </code></pre>
  
  <p>but I get the following error
  <code>ERROR - failed to write data to stream: &lt;open file '&lt;stdout&gt;', mode 'w' at 0x7f207949a150&gt;</code></p>