Loading django/core/management/commands/flush.py +7 −3 Original line number Diff line number Diff line Loading @@ -84,9 +84,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") Loading docs/releases/1.7.2.txt +3 −0 Original line number Diff line number Diff line Loading @@ -18,3 +18,6 @@ Bugfixes * Warn for duplicate models when a module is reloaded. Previously a RuntimeError was raised every time two models clashed in the app registry. (:ticket:`23621`). * Prevented :djadmin:`flush` from loading initial data for migrated apps (:ticket:`23699`). tests/fixtures_migration/__init__.py 0 → 100644 +0 −0 Empty file added. tests/fixtures_migration/fixtures/initial_data.json 0 → 100644 +9 −0 Original line number Diff line number Diff line [ { "pk": "10", "model": "fixtures_migration.book", "fields": { "name": "Achieving self-awareness of Python programs" } } ] tests/fixtures_migration/migrations/0001_initial.py 0 → 100644 +16 −0 Original line number Diff line number Diff line # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): operations = [ migrations.CreateModel( "Book", [ ("name", models.CharField(max_length=100)), ], ), ] Loading
django/core/management/commands/flush.py +7 −3 Original line number Diff line number Diff line Loading @@ -84,9 +84,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") Loading
docs/releases/1.7.2.txt +3 −0 Original line number Diff line number Diff line Loading @@ -18,3 +18,6 @@ Bugfixes * Warn for duplicate models when a module is reloaded. Previously a RuntimeError was raised every time two models clashed in the app registry. (:ticket:`23621`). * Prevented :djadmin:`flush` from loading initial data for migrated apps (:ticket:`23699`).
tests/fixtures_migration/fixtures/initial_data.json 0 → 100644 +9 −0 Original line number Diff line number Diff line [ { "pk": "10", "model": "fixtures_migration.book", "fields": { "name": "Achieving self-awareness of Python programs" } } ]
tests/fixtures_migration/migrations/0001_initial.py 0 → 100644 +16 −0 Original line number Diff line number Diff line # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): operations = [ migrations.CreateModel( "Book", [ ("name", models.CharField(max_length=100)), ], ), ]