20👍
✅
Use natural keys: https://docs.djangoproject.com/en/dev/topics/serialization/#natural-keys
Most of the documentation refers to how to add the capability to your own models, but ContentType
already supports them so just add --natural-foreign
to your dumpdata
management command:
$ python manage.py dumpdata myapp --indent=4 --natural-foreign
Source:stackexchange.com