from django.db.models.deletion import Collector from django.db import router from myapp.models import MyModel def get_related(queryset): using = router.db_for_read(queryset.model) coll = Collector(using=using) coll.collect(queryset) return coll.data