How do I clone a model in such a way that it includes (clones) data on FK-related models? I've looked through various related questions on Stack, and found most of them are for old/outdated versions of Django. Here's some illustrative model code (with str methods, etc omitted for brevity):
class Tracking(models.Model):
entry = models.CharField(blank=False, max_length=50)
timestamp = models.DateTimeField(null=True, auto_now_add=True)
active = models.BooleanField(default=False)
class Author(models.Model):
entry = models.ForeignKey(Tracking, on_delete=models.CASCADE)
first_name = models.CharField(blank=False, max_length=50)
last_name = models.ImageField(null=True, blank=True)
class Scene(models.Model):
entry = models.ForeignKey(Tracking, on_delete=models.CASCADE)
location = models.CharField(blank=False, max_length=50)
image = models.ImageField(null=True, blank=True)
My desired result would be to clone an existing "entry" on the Tracking model, such that a new "entry" on a new row is created with its own PK, as well as cloned copies of "Author" and "Scene" data on their respective tables which also point to the new cloned "entry". Any pointers in the right direction would be helpful. I'm not finding anything in the django docs.