From 767c33d1fa9827908192e8ed1ac7f281f56bd811 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sat, 28 Feb 2015 16:36:19 +0100 Subject: [PATCH] Fixed #24369 -- Prevented crash when flushing before db migration Thanks Thomas Tanner for the report and Tim Graham for the review. --- django/core/management/commands/flush.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/django/core/management/commands/flush.py b/django/core/management/commands/flush.py index 3b12909902..840c78486a 100644 --- a/django/core/management/commands/flush.py +++ b/django/core/management/commands/flush.py @@ -75,7 +75,8 @@ Are you sure you want to do this? "The full error: %s") % (connection.settings_dict['NAME'], e) six.reraise(CommandError, CommandError(new_msg), sys.exc_info()[2]) - if not inhibit_post_migrate: + # Empty sql_list may signify an empty database and post_migrate would then crash + if sql_list and not inhibit_post_migrate: # Emit the post migrate signal. This allows individual applications to # respond as if the database had been migrated from scratch. emit_post_migrate_signal(verbosity, interactive, database)