From a921f0634583e2f87475e802e2674e7159b4f25b Mon Sep 17 00:00:00 2001 From: Javed Khan Date: Thu, 17 Oct 2013 16:24:20 +0530 Subject: [PATCH] Fixed #21280 -- Don't generate empty migration files --- django/core/management/commands/makemigrations.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/django/core/management/commands/makemigrations.py b/django/core/management/commands/makemigrations.py index e897bbdb9d..1079b4269c 100644 --- a/django/core/management/commands/makemigrations.py +++ b/django/core/management/commands/makemigrations.py @@ -82,5 +82,6 @@ class Command(BaseCommand): open(init_path, "w").close() # We just do this once per app directory_created[app_label] = True + migration_string = writer.as_string() with open(writer.path, "wb") as fh: - fh.write(writer.as_string()) + fh.write(migration_string)