Merge stdout.write() calls in squashmigrations.

This commit is contained in:
François Freitag 2020-04-28 06:28:34 +02:00 committed by Mariusz Felisiak
parent f19bb54fb1
commit 35f89d199c
1 changed files with 13 additions and 9 deletions

View File

@ -188,16 +188,20 @@ class Command(BaseCommand):
fh.write(writer.as_string()) fh.write(writer.as_string())
if self.verbosity > 0: if self.verbosity > 0:
self.stdout.write(self.style.MIGRATE_HEADING("Created new squashed migration %s" % writer.path)) self.stdout.write(
self.stdout.write(" You should commit this migration but leave the old ones in place;") self.style.MIGRATE_HEADING('Created new squashed migration %s' % writer.path) + '\n'
self.stdout.write(" the new migration will be used for new installs. Once you are sure") ' You should commit this migration but leave the old ones in place;\n'
self.stdout.write(" all instances of the codebase have applied the migrations you squashed,") ' the new migration will be used for new installs. Once you are sure\n'
self.stdout.write(" you can delete them.") ' all instances of the codebase have applied the migrations you squashed,\n'
' you can delete them.'
)
if writer.needs_manual_porting: if writer.needs_manual_porting:
self.stdout.write(self.style.MIGRATE_HEADING("Manual porting required")) self.stdout.write(
self.stdout.write(" Your migrations contained functions that must be manually copied over,") self.style.MIGRATE_HEADING('Manual porting required') + '\n'
self.stdout.write(" as we could not safely copy their implementation.") ' Your migrations contained functions that must be manually copied over,\n'
self.stdout.write(" See the comment at the top of the squashed migration for details.") ' as we could not safely copy their implementation.\n'
' See the comment at the top of the squashed migration for details.'
)
def find_migration(self, loader, app_label, name): def find_migration(self, loader, app_label, name):
try: try: