Skip to content

Instantly share code, notes, and snippets.

View baxeico's full-sized avatar

Augusto Destrero baxeico

View GitHub Profile
@baxeico
baxeico / dumpnested.py
Created April 8, 2024 20:08 — forked from alexhayes/dumpnested.py
Django management command to dump objects to JSON with all nested relations included.
"""
Dump out objects and all nested associations.
"""
import sys
from django.apps import apps
from django.contrib.admin.utils import NestedObjects
from django.core import serializers
from django.core.management import BaseCommand
from django.db import router