summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorTony Zhu <tony.zhu.249@gmail.com>2014-10-24 15:29:59 -0400
committerTim Graham <timograham@gmail.com>2014-10-27 06:56:44 -0400
commitdd1ea70779adff294140eddb0229c382e12f32f3 (patch)
treea23ffd770a1a9fada69219701d556fc656473d7c /django
parented7c4df1ee40b9a0793cd294614673fc312bbc33 (diff)
Fixed #23699 -- Prevented flush from loading initial data for apps with migrations.
Diffstat (limited to 'django')
-rw-r--r--django/core/management/commands/flush.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/django/core/management/commands/flush.py b/django/core/management/commands/flush.py
index 02f558b31d..53e5e389f0 100644
--- a/django/core/management/commands/flush.py
+++ b/django/core/management/commands/flush.py
@@ -85,9 +85,13 @@ Are you sure you want to do this?
# Reinstall the initial_data fixture.
if options.get('load_initial_data'):
- # Reinstall the initial_data fixture.
- call_command('loaddata', 'initial_data', **options)
-
+ # Reinstall the initial_data fixture for apps without migrations.
+ from django.db.migrations.executor import MigrationExecutor
+ executor = MigrationExecutor(connection)
+ app_options = options.copy()
+ for app_label in executor.loader.unmigrated_apps:
+ app_options['app_label'] = app_label
+ call_command('loaddata', 'initial_data', **app_options)
else:
self.stdout.write("Flush cancelled.\n")