diff --git django/core/management/commands/flush.py django/core/management/commands/flush.py
index ce3c6e8..e232290 100644
|
|
class Command(NoArgsCommand):
|
16 | 16 | make_option('--database', action='store', dest='database', |
17 | 17 | default=DEFAULT_DB_ALIAS, help='Nominates a database to flush. ' |
18 | 18 | 'Defaults to the "default" database.'), |
| 19 | make_option('--no-initial-data', action='store_false', dest='load_initial_data', default=True, |
| 20 | help='Tells Django not to load any initial data after database synchronization.'), |
19 | 21 | ) |
20 | 22 | help = ('Returns the database to the state it was in immediately after ' |
21 | 23 | 'syncdb was executed. This means that all data will be removed ' |
… |
… |
The full error: %s""" % (connection.settings_dict['NAME'], e))
|
79 | 81 | # Reinstall the initial_data fixture. |
80 | 82 | kwargs = options.copy() |
81 | 83 | kwargs['database'] = db |
82 | | call_command('loaddata', 'initial_data', **kwargs) |
| 84 | if options.get('load_initial_data', True): |
| 85 | # Reinstall the initial_data fixture. |
| 86 | from django.core.management import call_command |
| 87 | call_command('loaddata', 'initial_data', **options) |
83 | 88 | |
84 | 89 | else: |
85 | 90 | self.stdout.write("Flush cancelled.\n") |
diff --git django/core/management/commands/syncdb.py django/core/management/commands/syncdb.py
index 88caea1..e4590ef 100644
|
|
class Command(NoArgsCommand):
|
14 | 14 | option_list = NoArgsCommand.option_list + ( |
15 | 15 | make_option('--noinput', action='store_false', dest='interactive', default=True, |
16 | 16 | help='Tells Django to NOT prompt the user for input of any kind.'), |
| 17 | make_option('--no-initial-data', action='store_false', dest='load_initial_data', default=True, |
| 18 | help='Tells Django not to load any initial data after database synchronization.'), |
17 | 19 | make_option('--database', action='store', dest='database', |
18 | 20 | default=DEFAULT_DB_ALIAS, help='Nominates a database to synchronize. ' |
19 | 21 | 'Defaults to the "default" database.'), |
… |
… |
class Command(NoArgsCommand):
|
25 | 27 | verbosity = int(options.get('verbosity')) |
26 | 28 | interactive = options.get('interactive') |
27 | 29 | show_traceback = options.get('traceback') |
28 | | |
29 | | # Stealth option -- 'load_initial_data' is used by the testing setup |
30 | | # process to disable initial fixture loading. |
31 | 30 | load_initial_data = options.get('load_initial_data', True) |
32 | 31 | |
33 | 32 | self.style = no_style() |
diff --git docs/ref/django-admin.txt docs/ref/django-admin.txt
index 0ea8252..e61401c 100644
|
|
prompts.
|
245 | 245 | The :djadminopt:`--database` option may be used to specify the database |
246 | 246 | to flush. |
247 | 247 | |
| 248 | --no-initial-data |
| 249 | ~~~~~~~~~~~~~~~~~ |
| 250 | |
| 251 | ** New in Django development version ** |
| 252 | Use ``--no-initial-data`` to avoid loading the initial_data fixture. |
| 253 | |
248 | 254 | inspectdb |
249 | 255 | --------- |
250 | 256 | |
… |
… |
prompts.
|
1024 | 1030 | The :djadminopt:`--database` option can be used to specify the database to |
1025 | 1031 | synchronize. |
1026 | 1032 | |
| 1033 | --no-initial-data |
| 1034 | ~~~~~~~~~~~~~~~~~ |
| 1035 | |
| 1036 | ** New in Django development version ** |
| 1037 | Use ``--no-initial-data`` to avoid loading the initial_data fixture. |
| 1038 | |
1027 | 1039 | test <app or test identifier> |
1028 | 1040 | ----------------------------- |
1029 | 1041 | |