I have an app with 3 models that refer to each other in a parent-child way:
class A(Model):
# ...
class B(Model):
a = ForeignKey(A)
# ...
class C(Model):
b = ForeignKey(B)
# ...
In my production database, I have hundreds objects of type A, with thousands of child objects below it. I now want to create a fixture for only a (specific) handful objects. If I run this command, my output will become huge:
python manage.py dumpdata ca_myapp -o /tmp/my_app_dump.json
However, when I restrict the output using this command:
python manage.py dumpdata ca_myapp.A -o /tmp/myapp_dump.json --pks pk1, pk2, pk3
Then only the A objects are deserialized, but not their children. How can I easily create a fixture file with a handful of objects and their children?