Loading django/core/management/commands/flush.py +1 −16 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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, Loading @@ -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') Loading Loading @@ -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") Loading django/core/management/commands/loaddata.py +1 −7 Original line number Diff line number Diff line Loading @@ -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: Loading Loading @@ -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 Loading django/core/management/commands/migrate.py +0 −12 Original line number Diff line number Diff line Loading @@ -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.') Loading @@ -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. Loading Loading @@ -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 docs/howto/initial-data.txt +0 −15 Original line number Diff line number Diff line Loading @@ -76,21 +76,6 @@ from the fixture and re-loaded into the database. Note this means that if you change one of the rows created by a fixture and then run :djadmin:`loaddata` again, you'll wipe out any changes you've made. Automatically loading initial data fixtures ------------------------------------------- .. deprecated:: 1.7 If an application uses migrations, there is no automatic loading of fixtures. Since migrations will be required for applications in Django 1.9, this behavior is considered deprecated. If you want to load initial data for an app, consider doing it in a :ref:`data migration <data-migrations>`. If you create a fixture named ``initial_data.[xml/yaml/json]``, that fixture will be loaded every time you run :djadmin:`migrate`. This is extremely convenient, but be careful: remember that the data will be refreshed *every time* you run :djadmin:`migrate`. So don't use ``initial_data`` for data you'll want to edit. Where Django finds fixture files -------------------------------- Loading docs/ref/django-admin.txt +0 −6 Original line number Diff line number Diff line Loading @@ -341,12 +341,6 @@ prompts. The :djadminopt:`--database` option may be used to specify the database to flush. ``--no-initial-data`` ~~~~~~~~~~~~~~~~~~~~~ Use ``--no-initial-data`` to avoid loading the initial_data fixture. inspectdb --------- Loading Loading
django/core/management/commands/flush.py +1 −16 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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, Loading @@ -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') Loading Loading @@ -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") Loading
django/core/management/commands/loaddata.py +1 −7 Original line number Diff line number Diff line Loading @@ -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: Loading Loading @@ -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 Loading
django/core/management/commands/migrate.py +0 −12 Original line number Diff line number Diff line Loading @@ -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.') Loading @@ -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. Loading Loading @@ -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
docs/howto/initial-data.txt +0 −15 Original line number Diff line number Diff line Loading @@ -76,21 +76,6 @@ from the fixture and re-loaded into the database. Note this means that if you change one of the rows created by a fixture and then run :djadmin:`loaddata` again, you'll wipe out any changes you've made. Automatically loading initial data fixtures ------------------------------------------- .. deprecated:: 1.7 If an application uses migrations, there is no automatic loading of fixtures. Since migrations will be required for applications in Django 1.9, this behavior is considered deprecated. If you want to load initial data for an app, consider doing it in a :ref:`data migration <data-migrations>`. If you create a fixture named ``initial_data.[xml/yaml/json]``, that fixture will be loaded every time you run :djadmin:`migrate`. This is extremely convenient, but be careful: remember that the data will be refreshed *every time* you run :djadmin:`migrate`. So don't use ``initial_data`` for data you'll want to edit. Where Django finds fixture files -------------------------------- Loading
docs/ref/django-admin.txt +0 −6 Original line number Diff line number Diff line Loading @@ -341,12 +341,6 @@ prompts. The :djadminopt:`--database` option may be used to specify the database to flush. ``--no-initial-data`` ~~~~~~~~~~~~~~~~~~~~~ Use ``--no-initial-data`` to avoid loading the initial_data fixture. inspectdb --------- Loading