title: How do I make a deep clone of a model object in Django?
body: <p>To make a clone of a model in Django, I can use this trick:</p>
  
  <pre><code>object.pk=None;
  object.save();
  </code></pre>
  
  <p>Assume I have models A, AB, and ABC. AB has a foreign key of A, ABC has a foreign key of AB.</p>
  
  <p>Now if I want to make a deep clone of one A object a, I have to do it like this:</p>
  
  <pre><code>newa = deepcopy(a)
  newa.pk=None
  newa.save()
  
  ab = AB.objects.get(a=a)
  newab = deepcopy(ab)
  newab.a = newa;
  newab.pk=None
  newab.save()
  
  abc = ABC.objects.get(ab=ab)
  abc.pk=None;
  abc.ab=newab;
  abc.save()
  </code></pre>
  
  <p>This is a lot of trouble if there are multiple levels of relationship.
  Is there a convenient way to do this, like DELETE CASCADE in sql, only for clone?</p>