Ticket #25063: output_path_to_migration.diff

File output_path_to_migration.diff, 1.1 KB (added by Niels Van Och, 8 years ago)
  • django/core/management/commands/makemigrations.py

    diff --git a/django/core/management/commands/makemigrations.py b/django/core/management/commands/makemigrations.py
    index db011f9..5eaed01 100644
    a b def write_migration_files(self, changes):  
    172172                # Describe the migration
    173173                writer = MigrationWriter(migration)
    174174                if self.verbosity >= 1:
    175                     self.stdout.write("  %s:\n" % (self.style.MIGRATE_LABEL(writer.filename),))
     175                    # Write out the relative path if it's a sensible one, absolute otherwise
     176                    migration_string = os.path.relpath(writer.path)
     177                    if migration_string.startswith('..'):
     178                        migration_string = writer.path
     179                    self.stdout.write("  %s:\n" % (self.style.MIGRATE_LABEL(migration_string),))
    176180                    for operation in migration.operations:
    177181                        self.stdout.write("    - %s\n" % operation.describe())
    178182                if not self.dry_run:
Back to Top