summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2015-02-28 16:36:19 +0100
committerClaude Paroz <claude@2xlibre.net>2015-03-05 08:57:28 +0100
commit767c33d1fa9827908192e8ed1ac7f281f56bd811 (patch)
treea019971a1282732e24ee2d9226fbadee53e66201
parent39a7eed1bbf12020a077e4bec3d82e08f171a021 (diff)
Fixed #24369 -- Prevented crash when flushing before db migration
Thanks Thomas Tanner for the report and Tim Graham for the review.
-rw-r--r--django/core/management/commands/flush.py3
1 files changed, 2 insertions, 1 deletions
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)