()
| 144 | |
| 145 | # Iteratively return every object for all models to serialize. |
| 146 | def get_objects(): |
| 147 | from django.db.migrations.loader import MigrationLoader |
| 148 | |
| 149 | loader = MigrationLoader(self.connection) |
| 150 | for app_config in apps.get_app_configs(): |
| 151 | if ( |
| 152 | app_config.models_module is not None |
| 153 | and app_config.label in loader.migrated_apps |
| 154 | and app_config.name not in settings.TEST_NON_SERIALIZED_APPS |
| 155 | ): |
| 156 | for model in app_config.get_models(): |
| 157 | if model._meta.can_migrate( |
| 158 | self.connection |
| 159 | ) and router.allow_migrate_model(self.connection.alias, model): |
| 160 | queryset = model._base_manager.using( |
| 161 | self.connection.alias, |
| 162 | ).order_by(model._meta.pk.name) |
| 163 | chunk_size = ( |
| 164 | 2000 if queryset._prefetch_related_lookups else None |
| 165 | ) |
| 166 | yield from queryset.iterator(chunk_size=chunk_size) |
| 167 | |
| 168 | # Serialize to a string |
| 169 | out = StringIO() |
nothing calls this directly
no test coverage detected