Ticket #15926: 15926.patch

File 15926.patch, 3.4 KB (added by vlinhart, 12 years ago)
  • django/core/management/commands/flush.py

    diff --git django/core/management/commands/flush.py django/core/management/commands/flush.py
    index ce3c6e8..e232290 100644
    class Command(NoArgsCommand):  
    1616        make_option('--database', action='store', dest='database',
    1717            default=DEFAULT_DB_ALIAS, help='Nominates a database to flush. '
    1818                '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.'),
    1921    )
    2022    help = ('Returns the database to the state it was in immediately after '
    2123           'syncdb was executed. This means that all data will be removed '
    The full error: %s""" % (connection.settings_dict['NAME'], e))  
    7981            # Reinstall the initial_data fixture.
    8082            kwargs = options.copy()
    8183            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)
    8388
    8489        else:
    8590            self.stdout.write("Flush cancelled.\n")
  • django/core/management/commands/syncdb.py

    diff --git django/core/management/commands/syncdb.py django/core/management/commands/syncdb.py
    index 88caea1..e4590ef 100644
    class Command(NoArgsCommand):  
    1414    option_list = NoArgsCommand.option_list + (
    1515        make_option('--noinput', action='store_false', dest='interactive', default=True,
    1616            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.'),
    1719        make_option('--database', action='store', dest='database',
    1820            default=DEFAULT_DB_ALIAS, help='Nominates a database to synchronize. '
    1921                'Defaults to the "default" database.'),
    class Command(NoArgsCommand):  
    2527        verbosity = int(options.get('verbosity'))
    2628        interactive = options.get('interactive')
    2729        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.
    3130        load_initial_data = options.get('load_initial_data', True)
    3231
    3332        self.style = no_style()
  • docs/ref/django-admin.txt

    diff --git docs/ref/django-admin.txt docs/ref/django-admin.txt
    index 0ea8252..e61401c 100644
    prompts.  
    245245The :djadminopt:`--database` option may be used to specify the database
    246246to flush.
    247247
     248--no-initial-data
     249~~~~~~~~~~~~~~~~~
     250
     251** New in Django development version **
     252Use ``--no-initial-data`` to avoid loading the initial_data fixture.
     253
    248254inspectdb
    249255---------
    250256
    prompts.  
    10241030The :djadminopt:`--database` option can be used to specify the database to
    10251031synchronize.
    10261032
     1033--no-initial-data
     1034~~~~~~~~~~~~~~~~~
     1035
     1036** New in Django development version **
     1037Use ``--no-initial-data`` to avoid loading the initial_data fixture.
     1038
    10271039test <app or test identifier>
    10281040-----------------------------
    10291041
Back to Top