diff options
| author | Tim Graham <timograham@gmail.com> | 2014-12-26 13:23:38 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-01-17 09:59:25 -0500 |
| commit | 67235fd4ef1b006fc9cdb2fa20e7bb93b0edff4b (patch) | |
| tree | 7f2cf7cac4185235e3f066caf9ae5854f0f75bdb /django/core | |
| parent | f635d759354842e46901ed1ae1be5f5a0b81e567 (diff) | |
Removed support for initial_data fixtures per deprecation timeline.
Diffstat (limited to 'django/core')
| -rw-r--r-- | django/core/management/commands/flush.py | 17 | ||||
| -rw-r--r-- | django/core/management/commands/loaddata.py | 8 | ||||
| -rw-r--r-- | django/core/management/commands/migrate.py | 12 |
3 files changed, 2 insertions, 35 deletions
diff --git a/django/core/management/commands/flush.py b/django/core/management/commands/flush.py index 3158d65841..090e26357a 100644 --- a/django/core/management/commands/flush.py +++ b/django/core/management/commands/flush.py @@ -5,7 +5,6 @@ from importlib import import_module from django.apps import apps from django.db import connections, router, transaction, DEFAULT_DB_ALIAS -from django.core.management import call_command from django.core.management.base import BaseCommand, CommandError from django.core.management.color import no_style from django.core.management.sql import sql_flush, emit_post_migrate_signal @@ -15,8 +14,7 @@ from django.utils import six class Command(BaseCommand): help = ('Removes ALL DATA from the database, including data added during ' - 'migrations. Unmigrated apps will also have their initial_data ' - 'fixture reloaded. Does not achieve a "fresh install" state.') + 'migrations. Does not achieve a "fresh install" state.') def add_arguments(self, parser): parser.add_argument('--noinput', action='store_false', dest='interactive', default=True, @@ -24,9 +22,6 @@ class Command(BaseCommand): parser.add_argument('--database', action='store', dest='database', default=DEFAULT_DB_ALIAS, help='Nominates a database to flush. Defaults to the "default" database.') - parser.add_argument('--no-initial-data', action='store_false', - dest='load_initial_data', default=True, - help='Tells Django not to load any initial data after database synchronization.') def handle(self, **options): database = options.get('database') @@ -82,16 +77,6 @@ Are you sure you want to do this? if not inhibit_post_migrate: self.emit_post_migrate(verbosity, interactive, database) - - # Reinstall the initial_data fixture. - if options.get('load_initial_data'): - # 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") diff --git a/django/core/management/commands/loaddata.py b/django/core/management/commands/loaddata.py index aae69afc9b..15a90d727b 100644 --- a/django/core/management/commands/loaddata.py +++ b/django/core/management/commands/loaddata.py @@ -18,7 +18,6 @@ from django.utils import lru_cache from django.utils.encoding import force_text from django.utils.functional import cached_property from django.utils._os import upath -from django.utils.deprecation import RemovedInDjango19Warning from itertools import product try: @@ -218,14 +217,9 @@ class Command(BaseCommand): (fixture_name, humanize(fixture_dir))) fixture_files.extend(fixture_files_in_dir) - if fixture_name != 'initial_data' and not fixture_files: + if not fixture_files: # Warning kept for backwards-compatibility; why not an exception? warnings.warn("No fixture named '%s' found." % fixture_name) - elif fixture_name == 'initial_data' and fixture_files: - warnings.warn( - 'initial_data fixtures are deprecated. Use data migrations instead.', - RemovedInDjango19Warning - ) return fixture_files diff --git a/django/core/management/commands/migrate.py b/django/core/management/commands/migrate.py index c8fdde2b01..54d3617368 100644 --- a/django/core/management/commands/migrate.py +++ b/django/core/management/commands/migrate.py @@ -35,8 +35,6 @@ class Command(BaseCommand): ) parser.add_argument('--noinput', action='store_false', dest='interactive', default=True, help='Tells Django to NOT prompt the user for input of any kind.') - parser.add_argument('--no-initial-data', action='store_false', dest='load_initial_data', default=True, - help='Tells Django not to load any initial data after database synchronization.') parser.add_argument('--database', action='store', dest='database', default=DEFAULT_DB_ALIAS, help='Nominates a database to synchronize. ' 'Defaults to the "default" database.') @@ -50,7 +48,6 @@ class Command(BaseCommand): self.verbosity = options.get('verbosity') self.interactive = options.get('interactive') self.show_traceback = options.get('traceback') - self.load_initial_data = options.get('load_initial_data') # Import the 'management' module within each installed app, to register # dispatcher events. @@ -339,13 +336,4 @@ class Command(BaseCommand): finally: cursor.close() - # Load initial_data fixtures (unless that has been disabled) - if self.load_initial_data: - for app_label in app_labels: - call_command( - 'loaddata', 'initial_data', verbosity=self.verbosity, - database=connection.alias, app_label=app_label, - hide_empty=True, - ) - return created_models |
