              )
  
          # Work out the list of predecessor migrations
          migrations_to_squash = [
              executor.loader.get_migration(al, mn)
              for al, mn in executor.loader.graph.forwards_plan((migration.app_label, migration.name))
              if al == migration.app_label
          ]
  
          # Tell them what we're doing and optionally ask if we should proceed
          if self.verbosity > 0 or self.interactive:
 
</s> remove         executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
        if app_label not in executor.loader.migrated_apps:
 </s> add         loader = MigrationLoader(connections[DEFAULT_DB_ALIAS])
        if app_label not in loader.migrated_apps: </s> remove             migration = executor.loader.get_migration_by_prefix(app_label, migration_name)
 </s> add             migration = loader.get_migration_by_prefix(app_label, migration_name) </s> remove from django.db.migrations.executor import MigrationExecutor
from django.db.migrations.loader import AmbiguityError
 </s> add from django.db.migrations.loader import AmbiguityError, MigrationLoader
            loader.get_migration(al, mn)
            for al, mn in loader.graph.forwards_plan((migration.app_label, migration.name))
              )
  
          # Work out the list of predecessor migrations
          migrations_to_squash = [
            loader.get_migration(al, mn)
            for al, mn in loader.graph.forwards_plan((migration.app_label, migration.name))
            loader.get_migration(al, mn)
            for al, mn in loader.graph.forwards_plan((migration.app_label, migration.name))
              if al == migration.app_label
          ]
  
          # Tell them what we're doing and optionally ask if we should proceed
          if self.verbosity > 0 or self.interactive:
keep keep keep keep replace replace keep keep keep keep keep
 Fixed #24703 -- Changed squashmigrations to use a MigrationLoader

Changed squashmigrations to not instantiate a MigrationExecutor,
but to directly use a MigrationLoader instance instead. 
django/core/management/commands/squashmigrations.py